CeccoCQ
CeccoCQ

Reputation: 3754

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 disconnected from my web page (Logout or Timeout)?

Upvotes: 0

Views: 1967

Answers (1)

planetjones
planetjones

Reputation: 12633

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>

Upvotes: 3

Related Questions