ServletContextListener

  ServletContextListener: 此接口的实现类获得有关他们的一部分更改Web应用程序的servlet上下文通知。要接收通知事件,实现类必须为Web应用程序的部署描述符中进行配置。(web.xml中)

是全局的servlet容器监听  ,当容器加载web程序的时候会调用它的initialized方法   (ServletContextListener)

contextInitialized(ServletContextEvent e);

通知Web应用程序的初始化过程已开始。所有ServletContextListeners通知上下文初始化在web应用程序的任何过滤器或servlet初始化之前

contextDestroyed(ServletContextEvent e);

通知servlet上下文即将关闭。所有的servlet和过滤器已经destroy()了。在任何ServletContextListeners通知上下文销毁之前

/**

     ** Notification that the servlet context is about to be shut down. All

     * servlets and filters have been destroy()ed before any

     * ServletContextListeners are notified of context destruction.

     */

 

 

一般处理全局的信息初始化跟销毁

 

 --------------------------

 ServletContextEvent:

这是通知有关更改Web应用程序的servlet上下文(servletContext)的事件类

----------------------------------

 当向application域中增加或者移除对象的时候    这个监听器   ServletContextAttributeListener 会起作用

attributeAdded()  attributeReplaced()、attributeRemoved()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值