http://www.tuicool.com/articles/B7RNnev
1.下面两个方法,如果过长 的话会导致超时
web.xml
<listener>
<listener-class>com.PreloadListener</listener-class>
</listener>
java代码
public class PreloadListener implementsServletContextListener{
public void contextInitialized(ServeltContextEvent sce){
//init operation
}
public void contextDestoryed(ServeltContextEvent sce){
//destory operation
}
}
2.
Java代码
public class ClassName extends HttpServlet {
public voidinit() throws ServletException {
//把要做的事写到这里
}
}
web.xml文件中加上
<servlet>