ecsimsw
Servlet 생명 주기 본문
Servlet 생명 주기
@PostConstruct
init()
service()
destroy()
@PreDestory
생명 주기 관련 메소드
@WebServlet("/hello")
public class ServletEX extends HttpServlet {
private static final long serialVersionUID = 1L;
@PostConstruct
public void funcA() {
System.out.println("PostConstruct");
}
@Override
public void init() throws ServletException{
System.out.println("init");
}
@Override
public void destroy() {
System.out.println("destroy");
}
@PreDestroy
public void funcB() {
System.out.println("PreDestroy");
}
public ServletEX() {
super();
System.out.println("construct");
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.getWriter().append("Served at: ").append(request.getContextPath());
System.out.println("doGet");
}
}
construct
PostConstruct
init
doGet
destory
PreDestory
'Server application > Web, Servlet' 카테고리의 다른 글
WEB / URL 예약 문자와 인코딩 (0) | 2020.05.11 |
---|---|
Servlet / get & post (0) | 2020.05.10 |
Servlet mapping (0) | 2020.05.10 |
JSP / 초기 설정 (0) | 2020.05.09 |
Apache / Tomcat (0) | 2020.03.01 |
Comments