Troy,
Use the out.flush() method to output a partial page. Here's the text of an
email that I sent to the Strut-User mailing list about this same question.
<snip>
There is also another way to accomplish your goal that doesn't use the
refresh header. Basically, a servlet or JSP outputs a partial HTML page
using the flush() method. The partial page contains JavaScript that
typically writes out HTML tags that produce a table inside a <span> element
using the document.write(). The setTimeout JS method is then used to output
additional tags using the document.getElementById().innerHTML property to
output an image (typically animated) to the screen.

An onLoad attribute is used in the <body> tag to call another JavaScript
function that clears the timer and removes the animated image by setting the
innerHTML to "".

Once your task is finished, your servlet outputs the rest of the page
containing the </body></html> tags and possibly some JavaScript that
redirects to the completion page. I think this is the way that sites like
Expedia do their progress bars without using the refresh meta tag. It saves
the browser from having to poll the site and looks, in my opinion, slicker.
</snip>


-Richard


-----Original Message-----
From: Campano, Troy [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 04, 2003 10:08 AM
To: [EMAIL PROTECTED]
Subject: Re: JSP Loading Screen


Yes,
That's what I was using, however nothing got displayed to the screen until
after the page had loaded....so I thought maybe it was a problem with not
enough buffered data had accumulated to push out to the browser.

Has anyone built a JSP/JDBC loading screen?

Thanks for all your help!

~ Troy Campano ~

-----Original Message-----
From: Martin Gainty [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 04, 2003 4:04 PM
To: [EMAIL PROTECTED]
Subject: Re: JSP Loading Screen

Troy
You need to trigger the visibility attribute to 'hidden' or 'visible;.. see
http://javascript.internet.com/page-details/preload-page.html

Hth,
Martin Gainty


----- Original Message -----
From: "Campano, Troy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 04, 2003 7:10 AM
Subject: JSP Loading Screen


Is there any way to make a JSP loading screen for pages that take a long
time to load?

For example, I have a JSP page that returns many rows from a database via
JDBC. While it's fetching the rows it takes a while for the page to load.
During that time I'd like to have the page display a message saying "Please
wait while the page loads".

I tried to do something with JavaScript that displays a message Body onLoad
and then it goes away when  the page finishes loading, but it didn't work.

Any ideas on a way I could do this with JSP?
Maybe something with the buffer?

Thank you!

~ Troy Campano ~

========================================================================
===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set
JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

========================================================================
===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set
JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set
JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

Reply via email to