开发者

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜