Why you want to persist user session into database?
You can do that by storing not just the session but a session with the user name and timestamp. You can store some more info if you want to.
Joined: Aug 15, 2004
Originally posted by David O'Meara: If you want to persist data for a user, attach it to the user so that you can load it when the user logs in.
Cent percent agreement.
Joined: Sep 29, 2005
This is the problem :
We have web-applications containing folders. For example : the folder "fr" contains the French site, de folder "nl" the Dutch site. Also, some folders are used by both websites, they are also located at the same location "nl" and "fr" folders are.
Every jsp includes a header and a footer. The jsp's that are only used by that exact website include directly the right header and footer. When a user enters the homepage, he has to choose between "go to french" of "go to dutch". So at that point we set the language.
But those folders, containing jsp's that are used by both websites have a problem. So we let them include 2 jsp's : site_header.jsp and site_footer.jsp. Those 2 files check the session, retrieve the language that was set when the user entered the homepage and load the exact footer and header.
So : when a user waits too long, and he continues to browse, and he enters a jsp that includes the site_header and footer jsp's, he won't see any header and footers because the session was invalidated and no language was set.
That's why I thought maybe I could store the session into a database.
Joined: Aug 15, 2004
Thats why we said, "you need the data stored in session, not the session". Yes you can persist that particular attribute or all attributes along with the user-name.
I hope you just would like to show the message in his/her preferred language. The messaage could be like, "Your session has been expired". Because after session expiry there is no means to allow him/her work. If you want them to work even when session has been expired, then you had better set session-timeout to -1.