• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

auto-save from data when session times out

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am developing an application using Struts 2. I need to save form data to database automatically before session times out (like the user walks away ...). Anybody has any idea how I can do it, please?

Thanks.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Save it when the form is submitted?
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use javascript to periodically submit request to keep my session alive for one of my screens. You could do something similar to automatically save after a time interval. Or display a message to your user letting them know that thier session is timing out.

There maybe be better ways, but that was what I came up with.
 
Teresa Lee
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by David Newton:
Save it when the form is submitted?



No. The situation is like this: the user is doing some data entry and he got an emergency call and he has to walk away immediately ( even has no time to hit the save button) and when he comes back like in 2 hours he doesn't want to login and start all over again. He just wants to login and go back to whereever he was at before he left.

Thanks for your prompt reply.
 
Sheriff
Posts: 28394
100
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, save it when the form is submitted. You could wait until the session times out and then save it, but why wait? You didn't say why saving the data right away was unacceptable.

Edit: Let me put it this way. Suppose there was a network failure while the user was still working, and it took a couple of hours to repair that. Would you still have the same interest in having the user sign on and carry on from where he/she left off? If so, then you need to save the user's data as soon as it is submitted.
[ December 08, 2008: Message edited by: Paul Clapham ]
 
Teresa Lee
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The goal is that I have to somehow save the user's work into database even without the user submitting the form. This is one of the user requirement. I am thinking to initiate an Ajax call to save the form data into database when I detect that there is no user activity on the page for a time interval. Do you think it's doable?
 
Paul Clapham
Sheriff
Posts: 28394
100
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, I see. The point of the question is that there is no request yet.

Sure, sounds like that could be done via AJAX. But this is the Struts forum... maybe you should post this in the HTML and Javascript forum?
 
Teresa Lee
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All right. I will try to see if it works first. Otherwise, I will do as you said to post my question somewhere else. Thanks.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think there is a session timeout event listener available, you can explore that option whether it is usable.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic