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
'WEB > JSP' 카테고리의 다른 글
[JSP] ch02-02. declaration (0) | 2017.11.01 |
---|---|
[JSP] ch02-01. scriptlet (0) | 2017.11.01 |
[JSP] ch01-03. 서블릿 클래스 GET, POST 방식 (0) | 2017.11.01 |
[JSP] ch01-02. 서블릿 클래스 POST 방식 (0) | 2017.11.01 |
[JSP] ch01-01. 서블릿 클래스 GET 방식 (0) | 2017.11.01 |
댓글