servlet 설정파일

프로젝트명/WebContent/WEB-INF 폴더에 존재

 

● URL Mapping 

 - servlet-name으로 연결되어 servlet-class와 url-pattern이 맵핑됨

<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>sample</servlet-name>
        <servlet-class>servlet.MyServlet2</servlet-class>	<!-- 프로젝트명.클래스명 -->
    </servlet>
    <servlet-mapping>
        <servlet-name>sample</servlet-name>
        <url-pattern>/my2</url-pattern>				<!-- 맵핑할 주소 -->
    </servlet-mapping>
</web-app>

 

● error 처리

<error-page>
    <error-code>500</error-code>
    <location>/error/error500.jsp</location>
</error-page>
<error-page>
    <exception-type>java.lang.NullPointerException</exception-type>
    <location>/error/errorNullPointer.jsp</location>
</error-page>

 

● EL 무시

<jsp-config>
    <jsp-property-group>
        <url-pattern>/ignoredEl/*</url-pattern>		<!-- 폴더명 -->
        <el-ignored>true</el-ignored>
    </jsp-property-group>
</jsp-config>

'Web > JSP&Servlet' 카테고리의 다른 글

자바 빈(Bean)  (0) 2020.08.01
JSP&Servlet 디렉토리  (0) 2020.07.31
[JSP] 내장 객체 - response  (0) 2020.07.31
[JSP] 내장 객체 - request  (0) 2020.07.31
DAO, DTO  (0) 2020.07.29

+ Recent posts