WEB/JSP

[JSP] ch01-04. LifeCycle

밍글링글링 2017. 11. 1.
728x90

1-4. LifeCycle

 

@WebServlet("/ch01/ex04/lifecycle")
public class LifeCycle extends HttpServlet {
    private int initCnt = 0;
    private int doGetCnt = 0;
    private int destroyCnt = 0;

    public void init(ServletConfig conf) throws ServletException{
        System.out.printf("intiCnt: %d\n", ++initCnt);
    }
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
            System.out.printf("doGetCnt: %d\n", ++doGetCnt);
    }
    public void destroy(){
        System.out.printf("destroyCnt: %d\n", ++destroyCnt);
    }
}

 

 

728x90

댓글