Showing an intermediate page to the user while the requested page is loading using servlets
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Shailesh_Kumar
Posted On:   Thursday, May 16, 2002 05:10 PM

When the user clicks submit on a form in a jsp ,the request goes to a servlet which starts processing the request. I want to show the user an intermediate page saying 'Page Loading ...'. To achieve this, as soon as the request comes to the servlet I write a page to the browser with the the following meta tag The page refreshes itself and,I have a mechanism in my servlet that determines that the intermediate page has been loaded and now start processing the actual request The problem is as soon as the intermediate page refreshes itself ,IE says 'the browser needs to resend information ... ' If one clicks on retry ,things work ok .However,obviously i dono   More>>

When the user clicks submit on a form in a jsp ,the request goes to a servlet which starts processing the request.

I want to show the user an intermediate page saying 'Page Loading ...'.

To achieve this, as soon as the request comes to the servlet I write a page to the browser with the the following meta tag




The page refreshes itself and,I have a mechanism in my servlet that determines that the intermediate page has been loaded and now start processing the actual request


The problem is as soon as the intermediate page refreshes itself ,IE says 'the browser needs to resend information ... '

If one clicks on retry ,things work ok .However,obviously i donot want to show this message to the user.This happens only when the requesting page submits a form using post.



Thanks
S

   <<Less

Re: Showing an intermediate page to the user while the requested page is loading using servlets

Posted By:   michael_dean  
Posted On:   Thursday, May 23, 2002 06:21 PM

You can specify a new location for the refresh, and if you do so, the browser must submit the request using the GET method (or at least, must do so to be compliant with the HTTP spec, but that's another story). Since GET is guaranteed to be safe and idempotent, the browser will not have to ask the user before submitting the request. Just make sure that your doGet(...) method actually is safe and idempotent (see RFC 2616, Section 9.1).



My understanding from your question is that you are using the same servlet to handle both requests. If this is true, just specify the same location for the refresh header and the browser will submit using GET, dropping all POST data (not changing it to a GET query string). This means that the POSTed data will not be available on the second request, so you will have to use some other means of identifying the user (i.e. HttpSessions or pass some identifier as a parameter in a "manually created" GET query string).



Also, I highly recommend that you replace your





with a





tag as specified in the HTML specification, section 7.4.4.2. If you need to add parameters, use something like





Note also that "client-side" refresh headers are not supported by all user agents. Therefore, your application will not be accessible to all users. As a work around, make sure you include a link on the "splash" page to allow the user to manually check for the results.

Re: Showing an intermediate page to the user while the requested page is loading using servlets

Posted By:   Vladislav_Kamensky  
Posted On:   Saturday, May 18, 2002 04:01 AM

Look at com.oreilly.servlet package namely CacheHttpServlet class (afair). May be it's what you need.


http://www.servlets.com

About | Sitemap | Contact