This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

keep session alive after browser is closed

 
J You
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have the application with a typical login
page, and once the user logs on, some user
data will be saved in session attributes.
Now, I was asked to add such a feathure:the user
only want to login for one time every day.The
other times the user can go directly to the menu,
even after "close and then restart the browser".
I set the session time-out variable to be a
pretty big number.I found once the browser
is closed, the session is still alive(getSession(false)!=null),
but the session attributes have all been lost.
Is there any way to keep the session attributes
after the browser is closed?
I test the application with Tomcat3.3,and my
production server doesn't support Session Listener.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Setting the Session timeout to be very large will not work. After the browser is closed (for IE at least) all session cookies get destroyed. Therefore, the next visit will result in a new session being used.
You need to write a persistant cookie and then check for this cookie everytime the user visits. This is a standard industry technique.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BTW, this is probably better off in the Servlets or JSP Forums.
[ November 12, 2002: Message edited by: Chris Mathews ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic