开发者

How to use session.getLastAccessedTime()?

开发者 https://www.devze.com 2023-03-04 19:46 出处:网络
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.

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>
0

精彩评论

暂无评论...
验证码 换一张
取 消