• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Chuan Ren
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried the following, but still see the blank page.
 
Dushyant Bhardwaj
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No , I meant to place this code in your JSP where you
are displaying your records back.
Regards
Dushyant Bhardwaj
 
Jeffrey Hunter
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic