How to use session.getLastAccessedTime()?
I've to use a mechanism to track the last user logout (or when his session expired), can I do this?
I've read about this method session.getLastAccessedTime();
but I don't understand how it works. So, there are methods to get timestamp when user was disconnect开发者_Go百科ed from my web page (Logout or Timeout)?
I think you need to look at implementing an HttpSessionListener
. Using this you can fire some code each and every time a HTTP Session gets destroyed.
Here is the API documentation.
Don't forget to register it in web.xml e.g.
<listener>
<listener-class>yourpackage.SessionDestroyedLogger</listener-class>
</listener>
精彩评论