wood burning stoves 2.0*
The moose likes Servlets and the fly likes get the session time out value from the web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "get the session time out value from the web.xml" Watch "get the session time out value from the web.xml" New topic
Author

get the session time out value from the web.xml

shyam ji gautam
Ranch Hand

Joined: Sep 17, 2011
Posts: 48
i want to compare

lastactivity time > sessiontimeout


then update some value in data base and then logout

how i get session time out value which i manually define in web.xml for this xml and session last activity time
Piyush Joshi
Ranch Hand

Joined: Jun 10, 2011
Posts: 207

You can get lastAccessedTime and session timeout value both from the HttpSession interface methods. Read the JavaDocs for HttpSession.

But I think what you really need is a session listener, which listens for the timeout to occur. When timeout occurs and session is going to be destroyed then this listener will be notified and you can update the database using it.


Piyush
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: get the session time out value from the web.xml