wood burning stoves 2.0*
The moose likes JSP and the fly likes How to put loading... when page is loading? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "How to put loading... when page is loading?" Watch "How to put loading... when page is loading?" New topic
Author

How to put loading... when page is loading?

Chuan Ren
Ranch Hand

Joined: Aug 04, 2003
Posts: 42
if I have a JSP page that has a sql statment that pulls records from db. The db records is huge and when loading, the web page shows a blank page. How could I put an animated gif during the time when the data is loading ?
Thank you.
Dushyant Bhardwaj
Greenhorn

Joined: Apr 18, 2004
Posts: 28
You can try this ..
document.writeln('<HTML><TITLE></TITLE><BODY><DIV STYLE="position:absolute;left:10;font-Family:Sans-Serif;font-Size:18pt;visibility:show;"><CENTER><FONT COLOR="green"><B>Loading....</B></FONT></CENTER></DIV></BODY></HTML>');
Hope this helps you.
Regards
Dushyant Bhardwaj
Chuan Ren
Ranch Hand

Joined: Aug 04, 2003
Posts: 42
Thank you for your prompt reply. Do you mean this:
----
out.println(<HTML><TITLE></TITLE><BODY><DIV STYLE="position:absolute;left:10;font-Family:Sans-Serif;font-Size:18pt;visibility:show;"><CENTER><FONT COLOR="green"><B>Loading....</B></FONT></CENTER></DIV></BODY></HTML>');
SQL Statement ...
----
Thanks again.
Chuan Ren
Ranch Hand

Joined: Aug 04, 2003
Posts: 42
I tried the following, but still see the blank page.
Dushyant Bhardwaj
Greenhorn

Joined: Apr 18, 2004
Posts: 28
No , I meant to place this code in your JSP where you
are displaying your records back.
Regards
Dushyant Bhardwaj
Jeffrey Hunter
Ranch Hand

Joined: Apr 16, 2004
Posts: 305
I've done something similar using the following trick:
Suppose you are on page A, and the user clicks a button which calls a JSP or Servlet to load the data from the database.
On page A, when the button is clicked, I set a <DIV> to appear and display an animated .gif which basically displays the usual animation you see when file processing is occurring.
Page A will remain visible until the request is processed by the server and returned to the client, so while the request is being processed, the user will see your .gif.
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
You can also send the user to an intermediate page which shows some "loading "text and a "progress bar" and the page can refresh every X seconds and during the refresh looks for the data (perhaps in a session variable or something) then when a refresh occurs and the data is there, the user is forwarded to the actual data display.
For the "progress bar", you can display it in a table that looks like a progress bar and move the indicator right and left to show some movement.
I just did this myself in a Struts web-app I'm working on and it turned out very nice (IMO).
brian


My Java Freeware:<br />MACCC - <a href="http://maccc.pipasoft.com" target="_blank" rel="nofollow">http://maccc.pipasoft.com</a><br />Nator - <a href="http://nator.pipasoft.com" target="_blank" rel="nofollow">http://nator.pipasoft.com</a>
 
GeeCON Prague 2014
 
subject: How to put loading... when page is loading?