One way that I have done this is by first setting up a session and saving
all of the request data, then sending the "Please Wait" page, setting the
Refresh header to force a reload to the servlet delivering the data. In
this case, I have the doPost of the servlet handle the initial request and
send the wait page, then the goGet method actually does the number
crunching. (of course, it needs to check the session for valid data...)
This is done by
response.setHeader( "Refresh", "10;
URL=/servlet/servletName?myParameters=values" );
One drawback of this, is that the wait page shows up in the browser history,
which is inconvenient in the case where the user does one query, looks at
the data, then uses the back button to adjust the query, etc. The refresh
in the wait page will send the user back to the data, unless he hits back
again, soon enough.
I got around this by using, instead of the Refresh, the following document:
output.println("<html><script>\n<!-- \nfunction
r()\n{location.replace('/servlet/servletName?myParameters=values')}\n
-->\n</script>\n<body onLoad=\"setTimeout('r()',5000)\">");
(followed by the contents of the wait page)
which works in my case, since I am writing for the corporate intranet, and
have the luxury of a standardized browser.
The net result is that the user clicks on the query's submit button, and
gets a smooth display of "Wait..." then data.
HTH,
Chris Polley
> -----Original Message-----
> From: Michel [SMTP:[EMAIL PROTECTED]]
> I believe that if you just send an html page with the "Please wait..."
> message, you can do that. Then you can send the actual results.
>
>
> ----- Original Message -----
> From: Jackson Ching <[EMAIL PROTECTED]>
>
> > I like to know if it is posible to display a message "Please
> wait
> while still loading" to the client before sending the actual result from
> the
> servlet, i want to do this because some generated pages will take a long
> time to be displayed due to processes done by the servlet, i want to
> display
> that message so that the user will know that something is still happening
> in
> the server. sendredirect method will not do, any other method? Thanks
> >
> > jack
>
___________________________________________________________________________
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