---
title: "HttpSessionListener和HttpSessionAttributeListener"
author: "androider"
date: "2007-12-04T19:18:12Z"
tags: []
slug: "httpsessionlistener-httpsessionattributelistener"
draft: false
lastmod: "2007-12-04T19:18:12Z"
id: 145976
url: "https://androider.iteye.com/blog/145976"
---

public interface <span style="color:red">HttpSessionListener</span>
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) 方法。