-
1. Re: do something on session timeout
erdemyilmaz Feb 14, 2013 9:46 AM (in response to iegle)hi,
why do not prefer HttpSessionListener?
here an example:
importjavax.servlet.http.HttpSessionEvent;importjavax.servlet.http.HttpSessionListener;publicclassSessionListenerimplementsHttpSessionListener {
publicvoidsessionCreated(HttpSessionEvent event) {System.out.println("Session Created: "+ event.getSession().getId());System.out.println("Total Sessions: "+ sessionCount);}publicvoidsessionDestroyed(HttpSessionEvent event) {System.out.println("Session Destroyed: "+ event.getSession().getId());System.out.println("Total Sessions: "+ sessionCount);}}regards,
Erdem
-
2. Re: do something on session timeout
iegle Feb 14, 2013 9:58 AM (in response to erdemyilmaz)thx a lot for your answer, its perfectly doing what i want. the funny thing is that i just looked it up 5 minutes before i read your answer. but thx a lot anyway.
ONLY one thing might be important for anyone who has the same issue- you need to register that listener in the web.xml like this:
<listener>
<listener-class>myPackage.NameOfMyListenerClass</listener-class>
</listener>
best wishes