반응형
Firtst.java
package exam01;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class First extends HttpServlet {
//
@Override
public void init() throws ServletException {
// TODO Auto-generated method stub
System.out.println("init() 메서드 호출");
}
//브라우저의 요청을 처리한다.
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// TODO Auto-generated method stub
System.out.println("doGet() 메서드 호출");
}
//
@Override
public void destroy() {
// TODO Auto-generated method stub
System.out.println("destroy() 메서드 호출");
}
}
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" id="WebApp_ID" version="4.0">
<servlet>
<servlet-name>firstExam01</servlet-name>
<servlet-class>exam01.First</servlet-class>
</servlet>
<servlet>
<servlet-name>secondExam01</servlet-name>
<servlet-class>exam01.Second</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>firstExam01</servlet-name>
<url-pattern>/test01</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>secondExam01</servlet-name>
<url-pattern>/test02</url-pattern>
</servlet-mapping>
</web-app>
동작과정
반응형
'web > JSP' 카테고리의 다른 글
[JSP]JSP 지시자(지시어), 페이지에 공통요소(header,footer) include하기 (0) | 2020.07.20 |
---|---|
[JSP] 쿼리 스트링( 파라미터) (0) | 2020.07.17 |
[JSP]서버 오류코드의 의미-상태 코드(Status Code) (0) | 2020.07.17 |
서블릿(Servlet) (0) | 2020.07.14 |
[JSP]CH01. 웹프로그래밍 (0) | 2020.07.13 |
댓글