25 监听器Listener——ServletContext监听器

ServletContext监听器

有关信息请跳转这里

两个接口

ServletContextListener:监听servletContextListener对象的创建和销毁

ServletContextAttributeListener:监听servletContextListener对象里的数据的增删改

 

示例:

public class Listener implements ServletContextListener,ServletContextAttributeListener{
	
	/*------------------------application监听器-----------------------------------------*/
	@Override
	public void attributeAdded(ServletContextAttributeEvent event) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void attributeRemoved(ServletContextAttributeEvent event) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void attributeReplaced(ServletContextAttributeEvent event) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void contextDestroyed(ServletContextEvent sce) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void contextInitialized(ServletContextEvent sce) {
		// TODO Auto-generated method stub
		
	}
	
	
}	

  

 

posted @ 2020-03-02 17:29  Scorpicat  阅读(136)  评论(0编辑  收藏  举报