Dave,

This topic has popped up several times before in this list.  I have my own favorite 
way of solving this problem but to see some of the others you may want to visit this 
list's archive...

What I do is this:

I have an html page with an initial request in the form of a hyperlink or html form 
that calls a servlet when clicked.  Let's say it's called "/servlet/DatabaseAccessor". 
  Within the servlet's service method I have two sections, one for the "please wait" 
page and one for retrieving and outputting the results.  The "please wait" page is 
returned if a certain parameter is not present in the initial request.  It looks like 
this...

String action = req.getParameter("action");
if (action == null)
 // output a "please wait" screen that has a "refresh" value in a <meta> tag that 
looks like this:
 // <meta http-equiv="refresh" 
content="0;url=/servlet/DatabaseAccessor?action=search&param1=xxx&param2=yyy">
if (action.equals("search"))
  // perform the search and spit out the results into the page

In effect, the servlet redirects to itself but it adds a parameter "action=search" 
that causes the search section of the servlet to happen and the results to display.

The "please wait" page is displayed first, after the initial request, and then because 
the refresh time is 0 it redirects right away back to the servlet which starts working 
on the results, but the "please wait" page will sit there until the next page - your 
results - starts outputting to the screen.  Just make sure that your results section 
of the servlet waits to send _any_ html until the entire resultset is retrieved and 
ready to output, otherwise you might possibly get a partial page sento to the client 
(which will clear the Please Wait stuff) and then the effect is broken.

Hope this helps,

Darren Houle

>>> Dave Muehling <[EMAIL PROTECTED]> 03/26 1:10 PM >>>
Hello all.

I have the folowing problem.  I'm trying to create a "please wait while getting 
results" page during a database pull.

Every time I try to insert code to bring up a page that says "please wait...", I 
either never get beyond that code (on the front end) or I get my results on the same 
page, at the same time, after a considerable wait.

The DB takes approx. 30 sec. to do a very large query and I would like to have some 
kind of page come up to distract the user from this wait time.

I think I need to somehow do a redirect, but how do I know when my page is done being 
built? And how do I keep track of users if I leave and come back? I looked into 
signing each result set with a session variable but couldn't figure it out.

Please help.

Dave Muehling

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to