您的位置:首页 > 编程语言 > Java开发

JAVA_Web_Listener

2016-03-22 21:38 441 查看

监听器

1.概念

(1)本身是一个对象
(2)监听其他对象
(3)响应其他对象




2.用途

(1)统计在线人数和在线用户
(2)系统启动时加载初始化信息
(3)统计网站访问量
(4)跟Spring结合的操作


3.启动顺序

(1)多个监听器:按注册顺序
(2)优先级:监听器>过滤器>Servlet


4.分类

4.1按监听对象:

(1)ServletContextListener接口
(2)HttpSessionListener接口
(3)ServletRequestListener接口

方法:initial()/destroyed()


4.2按对象属性:

(1)ServletContextAttributeListener接口
(2)HttpSessionAttributeListener接口
(3)ServletRequestAttributeListener接口

方法: attributeAdded()/attributeRemoved()/attributeReplaced
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: