| Author |
How to Handle timeout to save user input
|
Christopher McCauley
Greenhorn
Joined: Jan 03, 2005
Posts: 27
|
|
Greetings to All, I have a problem that I believe has already been solved womewhere but I am not sure how to find the solution or cure it. When a users session timesout, then they issue a submit. It fails because of an attribute that was in the session is missing. The submit would work if the attributes in the session were refreshed, but I need to know when the session has timed out. How might I save the (html) form they had filled out, have them log in again and then return to that page and issue the same submit? Thanks for any suggestions. mccools  [ May 26, 2005: Message edited by: Christopher McCauley ]
|
JCM<br />good at cookin'
|
 |
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
|
|
|
session-timeout under session-config element in web.xml define the value of session timeout. we can overwrite it using setMaxInactiveInterval() method of HttpSession.
|
 |
Sharad Agarwal
Ranch Hand
Joined: Sep 11, 2002
Posts: 167
|
|
Originally posted by Christopher McCauley: How might I save the (html) form they had filled out, have them log in again and then return to that page and issue the same submit? [ May 26, 2005: Message edited by: Christopher McCauley ]
Translate the form parameters into a bean on the server and save it in the session. Once you have performed the authorization process, read the bean and pre-populate the form for the user. Does this address the question or was there something else you were looking for?
|
Alco-Haul: We move spirits.
Demented Deliberations of a Dilettante
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12324
|
|
If I understand the problem, you want to preserve a partially filled out form contents past the expiration of a session. If you keep the contents in a JavaBean type object, where the object implements the HttpSessionBindingListener, the object will get notified when the session is being destroyed. At that point you might serialize the bean to disk or otherwise save the state. Obviously there will have to be some mechanism to recover the bean when they log back in. Bill
|
Java Resources at www.wbrogden.com
|
 |
Adeel Ansari
Ranch Hand
Joined: Aug 15, 2004
Posts: 2874
|
|
|
Or simply make it, session-timeout, -1.
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12324
|
|
|
If the session never times out and you depend on every user specifically logging out for clean up, you will eventually clog the system with old abandoned sessions.
|
 |
Christopher McCauley
Greenhorn
Joined: Jan 03, 2005
Posts: 27
|
|
Thank you all, we are using ActionForms (Struts) to back all the forms. I am quite sure I can implement the listener interface to catch the notify(). [ May 27, 2005: Message edited by: Christopher McCauley ]
|
 |
 |
|
|
subject: How to Handle timeout to save user input
|
|
|