-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSampleServlet.java
More file actions
30 lines (26 loc) · 1016 Bytes
/
SampleServlet.java
File metadata and controls
30 lines (26 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package org.zerock.tomproject.calc;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet(name = "sampleServlet", urlPatterns = "/sample")
public class SampleServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
System.out.println("doGet..."+this);
// urlPattern을 시작 후 호출할 때 작동
}
@Override
public void destroy() { // tomcat terminate
System.out.println("destroy...");
}
@Override
public void init(ServletConfig config) throws ServletException {
System.out.println("init(ServletConfig)...");
// urlPattern에 맞는 Servlet 시작 시 작동
}
}