监听器 ServletContextListener

跟HttpSessionListener有些相似,需要在Web.xml中配置,都是在服务器启动的时候实例化。

ServletContextListener的销毁 是在服务器关闭的时候。

两个方法————————————

初始化

public void contextInitialized(ServletContextEvent event){

销毁

public voidcontextDestoryed(ServletContextEvent event){

}

原文地址:https://www.cnblogs.com/javaxiaodoufu/p/7381903.html