javaweb的监听器监听的事件源为:ServletContext/HttpSession/ServletRequest,即三个域对象
(1)监听域对象创建与销毁的监听器(生命周期监听器,3个)
ServletContextListener/HttpSessionListener/ServletRequestListener
(2)监听域对象操作域属性的监听器(属性监听器,3个)
ServletContextAttributeListener/HttpSessionAttributeListener/ServletRequestAttributeListener
(3)监听HttpSession的监听器(2个)
HttpSessionBindingListener/HttpSessionActivationListener
监听器接口 方法&描述
(1)监听域对象创建与销毁的监听器(生命周期监听器,3个)
ServletContextListener void contextlnitialized(ServletContextEvent sce)创建ServletContext对象时调用
void contextDestroyed(ServletContextEvent sce)销毁ServletContext对象时调用
HttpSessionListener void sessionCreated(HttpSessionEvent se)创建Session对像时调用
void sessionDestroyed(HttpSessionEvent se)销毁Session对象时调用
ServletRequestListener void requestInitialized(ServletRequestEvent sre)创建request时调用
void requestDestroyed(ServletRequestEvent sre)销毁request时调用
(2)监听域对象操作域属性的监听器(属性监听器,3个)
ServletContextAttributeListener void at