Servlet&JSP學習之servlet屬性和監(jiān)聽(2)_八大太監(jiān)(監(jiān)聽)
Servlet的8大太監(jiān)(監(jiān)聽)
場景 | 監(jiān)聽者接口 | 事件類型 |
你想知道一個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 |
你想知道有多少個并發(fā)用戶,也就是說,你想跟蹤活動會話 | javax.servlet.http.HttpSessionListener sessionCreated sessionDestoryed | HttpSessionEvent |
你想知道是否創(chuàng)建或者撤銷了一個上下文 | javax.servlet.ServletContextListener contextInitialized contextDestoryed | ServletContextEvent |
你有一個屬性類(這個屬性類的對象將被放在一個屬性中),而且你希望這個類型的對象綁定到一個會話或從一個會話刪除時得到通知 | javax.servlet.http.HttpSessionBindingListener valueBound valueUnbound | HttpSessionBindingEvent |
你有一個屬性類,而且你喜歡子屬性對象綁定的會話遷移到另一個JVM時得到通知 | javax.servlet.http.HttpSessionActivationListener sessionDidActivate sessionWillPassivate | HttpSessionEvent |
posted on 2008-12-23 18:48 peterJ 閱讀(337) 評論(0) 編輯 收藏 所屬分類: Servlet&JSP