728x90
* URL 맵핑은 보안상 문제로 경로 노출을 방지하기 위해 사용한다.
Servlet의 특징
동적 웹어플리케이션 컴포넌트
확장자는 .java
클라이언트의 요청에 동적으로 작동한다.
java thread를 이용해서 동작한다. (서버에 대한 부하를 줄여줄 수 있다.)
MVC패턴에서 controller로 이용된다.
Mapping의 특징
기존의 경로 : http://localhost:8080/test/servlet/com.test.ex.Test
URL 맵핑 경로 : http://localhost:8080/test/Te
*맵핑 방법
1. web.xml에서 서블릿 맵핑
2. 어노테이션[@WebServlet("/Te")]을 이용
web.xml 편집 (web.xml을 이용한 서블릿 맵핑)
<servlet>
<servlet-name>testServlet</servlet-name>
<servlet-class>com.test.ex.Test</servlet-class>
<servlet-maping>
<servlet-name>testServlet</servlet-name>
<url-pattern>/Te</url-pattern>
</servlet-mapping>
</servlet>
728x90