import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextAttributeEvent;
import javax.servlet.ServletContextAttributeListener;
import java.io.*;
public final class ServletContextListenerExample
    implements ServletContextListener,ServletContextAttributeListener {
    public void contextDestroyed(ServletContextEvent sce) {
	System.out.println("contextDestroyed()-->ServletContext被销毁");
    }
    public void contextInitialized(ServletContextEvent sce) {
	System.out.println("contextInitialized()-->ServletContext初始化");
    }
  
    public void attributeAdded(ServletContextAttributeEvent scae) {
	System.out.println("增加了一个属性：attributeAdded('" + scae.getName() + "', '" +
	    scae.getValue() + "')");
    }
    public void attributeRemoved(ServletContextAttributeEvent scae) {
	System.out.println("删除了一个ServletContext属性：attributeRemoved('" + scae.getName() + "', '" +
	    scae.getValue() + "')");
    }
    public void attributeReplaced(ServletContextAttributeEvent scae) {
	System.out.println("某个ServletContext的属性被改变：attributeReplaced('" + scae.getName() + "', '" +
	    scae.getValue() + "')");
    }
}

