Servlet的8大监听者
场景 监听者接口 事件类型 你想知道一个WEB应用是否添加,删除或替换了一个上下文属性 Javax.servlet.ServletContextAttributeListener
attributeAdded
attributeRemoved
attributeReplaced ServletContextAttributeEvent 你想知道什么时候添加,删除或者替换一个请求属性 Javax.servlet.ServletRequestAttributeListener
attributeAdded
attributeRemoved
attributeReplaced ServletRequestEvent 你想知道什么时候添加,删除或者替换一个会话属性 javax.servlet.http.HttpSessionAttributeListener
attributeAdded
attributeRemoved
attributeReplaced HttpSessionBindingEvent 每次请求到来你都想知道,以便建立日志记录或者干点初始化之类的事情 Javax.servlet.ServletRequestListener
requestInitialized
requeseDestoryed ServletRequestEvent 你想知道有多少个并发用户,也就是说,你想跟踪活动会话 javax.servlet.http.HttpSessionListener
sessionCreated
sessionDestoryed
HttpSessionEvent 你想知道是否创建或者撤销了一个上下文 javax.servlet.ServletContextListener
contextInitialized
contextDestoryed ServletContextEvent 你有一个属性类(这个属性类的对象将被放在一个属性中),而且你希望这个类型的对象绑定到一个会话或从一个会话删除时得到通知 javax.servlet.http.HttpSessionBindingListener
valueBound
valueUnbound HttpSessionBindingEvent 你有一个属性类,而且你喜欢子属性对象绑定的会话迁移到另一个JVM时得到通知 javax.servlet.http.HttpSessionActivationListener
sessionDidActivate
sessionWillPassivate HttpSessionEvent