2005-10-27
implements HttpSessionListener
[Important] The application container should support servlet 2.3 standard.
==================web.xml==============================
<?xml version = '1.0' encoding = 'ISO-8859-1'?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
<web-app>
<-- Listeners -->
<listener>
<listener-class> com.util.SessionListener </listener-class>
</listener>
<!-- Action Servlet Configuration -->
<servlet>
........
</servlet>
</web-app>
======================SessionListener.java==============================package com.util;
public class SessionListener implements HttpSessionListener{
public SessionListener() { }
public void sessionCreated(HttpSessionEvent se) {
SystemLog log = new SystemLog(Utility.class);
HttpSession session = se.getSession();
String id=session.getId();
log.debug("======Session ==== "+id);
}
public void sessionDestroyed(HttpSessionEvent se) {
SystemLog log = new SystemLog(Utility.class);
HttpSession session = se.getSession();
String id=session.getId();
log.debug("=======Session Destroyed===== "+id);
}
}