aspose file tools*
The moose likes Servlets and the fly likes How to display an Intermediate Page during a form Submission ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to display an Intermediate Page during a form Submission ?" Watch "How to display an Intermediate Page during a form Submission ?" New topic
Author

How to display an Intermediate Page during a form Submission ?

abinash das
Ranch Hand

Joined: Apr 26, 2008
Posts: 52
Hi,

I have a scenario like i am submitting a form and to get the response it takes around 4-5 mins.
What i want is how can i display an Intermediate page with one image during the time interval ?
And once the output is constructed properly that Intermediate page should be blocked

thanks in advance.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31067
    
232

You need two servlets for this. The first serlvet takes the form submission and launches a new thread to do the work. It then redirects to your intermediary page. The second servlet periodically polls the HttpSession to see if the work is done. Then it redirects to the intermediate or done page as appropriate.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 650
What if you used two servlets, like this:

Post to your first servlet. It gathers all the information from the request and saves if off in the session data, then
forwards to a JSP.

The JSP displays a 'Please wait...' message and immediately posts to the second servlet.

The second servlet takes all the information from the session data and does the actual work.

No polling or worker thread required.

That is as long as the work won't cause the request thread to time out.

Edit: Of course, you can do both tasks in the same servlet, if you want

Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31067
    
232

Some browsers timeout after 5 minutes. (under certain conditions; I'm not clear on exactly what they are as at other times they appear to wait forever; maybe a VPN thing.) If a request is estimated to take 4-5 minutes, this doesn't leave a lot of buffer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to display an Intermediate Page during a form Submission ?