代码:
public class test implements ServletContextListener{
public void contextInitialized(ServletContextEvent sce) {
}
public void contextDestroyed(ServletContextEvent sce) {
}
}
实现接口ServletContextListener
在web.xml中配置
<listener>
<listener-class>org.cai.MyListener</listener-class>
</listener>