• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

How to Handle timeout to save user input

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
session-timeout under session-config element in web.xml define the value of session timeout. we can overwrite it using setMaxInactiveInterval() method of HttpSession.
 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or simply make it, session-timeout, -1.
 
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Dinner will be steamed monkey heads with a side of tiny ads.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic