• Post Reply Bookmark Topic Watch Topic
  • New Topic

Another question about session tracking in JSP  RSS feed

 
Richard Yin
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx a lot for help from Dave.
If I want to keep the username valid for a user after his logging in unless he chooses "Logout",so what can I do to achieve that in JSP?
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Richard there might be a way to set the timeout lenght to infinite on tomcat, I'm not positive, but you should be able to check out the docs and find out.
Other than that I don't know of a way to get notice that a session is about to be destroyed, you can find out after the fact with an HttpSessionListener, but not before.
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set it to -1.
Also, according to the specs: "In the HTTP protocol, there is no explicit termination signal when a client is no longer active. This means that the only mechanism that can be used to indicate when a client is no longer active is a timeout period." (SRV.7.5 Session Timeouts)
 
chanoch wiggers
Author
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also, I'm not sure that setting the session running infinitely is the way to go - imagine the build up if everyone who was a customer got their own imortal session object. Instead require cookie use and just set a cookie that will log them in automatically. You can have a server event object that watches the session and can do pre finalization processing to save the latest state of the session if you need to
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!