Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to display an Intermediate Page during a form Submission ?

 
abinash das
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic