my dog learned polymorphism
The moose likes JSF and the fly likes How to prevent session timeout? How to keep user logged in? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How to prevent session timeout? How to keep user logged in?" Watch "How to prevent session timeout? How to keep user logged in?" New topic
Author

How to prevent session timeout? How to keep user logged in?

janek nowakowski
Greenhorn

Joined: Jun 20, 2010
Posts: 8
Hi, can anybody tell me how can I prevent situation when user writes a long review, go for a walk, come back to submit form and he lost all the text because of session timeout? I would be gratefull for any help!!
Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19751
    
  10

Write some Javascript which autosaves the contents of the form periodically. Example: GMail does this.
janek nowakowski
Greenhorn

Joined: Jun 20, 2010
Posts: 8
Thank you very much for a solution. Are there any other solutions of this problem?
janek nowakowski
Greenhorn

Joined: Jun 20, 2010
Posts: 8
I mean, is there solution like "keep me logged in" so if there is session timeout, application search for cookies with login data and the session is restored with actual view. Can it be done in JSF?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17154
    
  27

Yes, but it requires a lot of work on the application's part. It's easier just to put a refresh meta-tag on the web page or to extend the timeout limit in web.xml.


An IDE is no substitute for an Intelligent Developer.
janek nowakowski
Greenhorn

Joined: Jun 20, 2010
Posts: 8
I thought so (that it's very complicated). I think, I will use refresh meta tag, because it is the simplest solution MANY THANKS!!!
Paul Clapham
Sheriff

Joined: Oct 14, 2005
Posts: 19751
    
  10

You could also do auto-login. Example: this site right here does it.
janek nowakowski
Greenhorn

Joined: Jun 20, 2010
Posts: 8
Ok, I can implement auto-login based on cookies, but I'm not sure how will the app react when the session expires. Probably some exception will be thrown and I don't know If I will be able to restore view and a text of a user.
janek nowakowski
Greenhorn

Joined: Jun 20, 2010
Posts: 8
I have found something interesting here -> user filter by BalusC. I'll check it tomorrow ;)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to prevent session timeout? How to keep user logged in?
 
It's not a secret anymore!