Monday, January 11, 2010

Detect http session created or destroyed

Implement HttpSessionListener and add the listener in web.xml. The methods will be triggered when a session is created or destroyed.

 

public class MyHttpSessionListener implements HttpSessionListener { 
public void sessionCreated(HttpSessionEvent se) {
System.out.println("created");
}

public void sessionDestroyed(HttpSessionEvent se) {
System.out.println("destroyed");
}

No comments:

Post a Comment