两个接口
HttpSessionListener :session对象的创建和销毁
HttpSessionAttributeListener :session中数据的增删改
public class Listener implements HttpSessionListener,HttpSessionAttributeListener{ /*------------------------session监听器-----------------------------------------*/ //监听session的创建 @Override public void sessionCreated(HttpSessionEvent se) { //获取session se.getSession(); } //监听session的销毁 @Override public void sessionDestroyed(HttpSessionEvent se) { //获取session se.getSession(); } //session属性的创建事件 @Override public void attributeAdded(HttpSessionBindingEvent event) { event.getName(); event.getValue(); } //session属性的删除事件 @Override public void attributeRemoved(HttpSessionBindingEvent event) { // TODO Auto-generated method stub } //session属性的修改事件 @Override public void attributeReplaced(HttpSessionBindingEvent event) { // TODO Auto-generated method stub } }