example ... servlet class name MyServlet.java
import java.io.IOException;import java.io.PrintWriter;import javax.servlet.ServletContextListener;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;public class MyServlet extends HttpServlet implements ServletContextListener {......// implement methodspublic void contextInitialized(ServletContextEvent sce) {System.out.println("MyServlet initialized...");}public void contextDestroyed(ServletContextEvent sce) {System.out.println("MyServlet destroyed...");}}
in web.xml
MyServlet
MyServlet
1
MyServlet
/MyServlet
MyServlet
30
No comments:
Post a Comment