Sun GlassFish Enterprise Server v3 Prelude Developer's Guide

ProcedureCreating a Welcome HTML Page That Contains IFrames for Receiving and Sending Updates

  1. Create an HTML page called index.html.

  2. Add the following content to the page:

    <html>
    	<head>
    		<title>Comet Example: Counter with Hidden Frame</title>
    	</head>
    	<body>
      </body>
    </html>
  3. Add IFrames for connecting to the server and receiving and sending updates to index.html in between the body tags:

    <frameset>
    	<iframe name="hidden" src="hidden_comet" 
    		frameborder="0" height="0" width="100%"></iframe>
    	<iframe name="counter" src="count.html" 
    		frameborder="0" height="100%" width="100%"></iframe>
    <iframe name="button" src="button.html" frameborder="0" height="30%" widget="100%"></iframe>
    </frameset>

    The first frame, which is hidden, points to the servlet by referencing its context path. The second frame displays the content from count.html, which displays the current count. The second frame displays the content from button.html, which contains the submit button for incrementing the counter.