File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

auto-save from data when session times out

 
Teresa Lee
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Save it when the form is submitted?
 
Tom Rispoli
Ranch Hand
Posts: 349
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Paul Clapham
Sheriff
Pie
Posts: 20187
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
Pie
Posts: 20187
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Vidyasagar Guduru
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think there is a session timeout event listener available, you can explore that option whether it is usable.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic