Browse DevX
Sign up for e-mail newsletters from DevX


iFrames + JSP = Enhanced Web Content Retrieval : Page 2

Used with JavaScript and JSP code, iFrames elegantly resolve the "hang" issue that occurs when a Web application fetches values from the server.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

The iFrame Solution
An iFrame element defines an inline frame for the inclusion of external objects, including other HTML documents. It enables you to easily open and position a Web page anywhere inside your main page without the hassle of classical frames. The following is HTML code for an iFrame:

<IFRAME SRC="xxx.htm" width="100" height="200"> <!-- Alternate content for non-supporting browsers --> </IFRAME>

Figure 1. The Registration Page

In the registration page of the example application, you will embed an iFrame containing another JSP page, which the application will use to communicate with the Servlet on behalf of its parent page. As a result, the application transparently submits the iFrame page without the user ever knowing it, thus eliminating the hang that occurs when it submits a page to the server. Figure 1 shows how the registration page looks.

The registration page has a "check name" button. Clicking this button runs a JavaScript function that passes the entered user name to the iFrame page and submits the page to the server. When the Servlet processes the iFrame page request, control returns to the iFrame page and it populates a message area in the parent window, indicating whether the login name is already used.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date