HttpSessionListener和HttpSessionAttributeListener
public interface HttpSessionListener extends java.util.EventListener Implementations of this interface are notified of changes to the list of active sessions in a web application. To receive notification events, the implementation class must be configured in the deployment descriptor for the web application
void sessionCreated(HttpSessionEvent se) Notification that a session was created. void sessionDestroyed(HttpSessionEvent se) Notification that a session is about to be invalidated.
HttpSessionAttributeListener监听 HttpSession中的属性的操作。当在Session增加一个属性时,激发attributeAdded(HttpSessionBindingEvent se) 方法;当在Session删除一个属性时,激发attributeRemoved(HttpSessionBindingEvent se)方法;当在Session属性被重新设置时,激发attributeReplaced(HttpSessionBindingEvent se) 方法。