Created
May 7, 2014 07:53
-
-
Save sjyun/fd113218a5b038f20b9e to your computer and use it in GitHub Desktop.
ServletLifeCycle.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import javax.servlet.ServletException; | |
| import javax.servlet.annotation.WebServlet; | |
| import javax.servlet.http.HttpServlet; | |
| import javax.servlet.http.HttpServletRequest; | |
| import javax.servlet.http.HttpServletResponse; | |
| @WebServlet("/life") | |
| public class ServletLifeCycle extends HttpServlet{ | |
| private static final long serialVersionUID = 1L; | |
| public void init(){ | |
| System.out.println("init"); | |
| } | |
| //init메소드가 호출된 이후에 호출됨 | |
| public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException { | |
| System.out.println("service"); | |
| doGet(request, response); | |
| doPost(request, response); | |
| } | |
| protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
| System.out.println("do Get 메소드 호출"); | |
| } | |
| protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
| System.out.println("doPost 메소드 호출"); | |
| } | |
| public void destroy() { | |
| System.out.println("destory 메소드 호출"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment