⑥ PreSTC/jsp / Servlet
[jsp/Servlet] Error page
재령
2008. 7. 24. 09:17
- web.xml 에서 error page 지정을 하지 않았을 경우
* 해당 에러페이지에 아래와 같은 코드를 반드시 넣어 주어야 함
<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
<%@ page isErrorPage="true" %>
<%
response.setStatus(200); // 상태를 반드시 알려주지 않으면 기본 에러 페이지가 뜬다.
%>
- web.xml 에서 error page 지정을 할 경우
* web.xml 파일에 아래와 같은 코드를 넣어 주어야 함
<error-page>
<error-code>404</error-code>
<location>/error/error404.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error/error500.jsp</location>
</error-page>
* 해당 에러페이지에 아래와 같은 코드를 반드시 넣어 주어야 함
<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
<%@ page isErrorPage="true" %>
<%
response.setStatus(200); // 상태를 반드시 알려주지 않으면 기본 에러 페이지가 뜬다.
%>
- web.xml 에서 error page 지정을 할 경우
* web.xml 파일에 아래와 같은 코드를 넣어 주어야 함
<error-page>
<error-code>404</error-code>
<location>/error/error404.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error/error500.jsp</location>
</error-page>