1. web.xml 에 http status code 에 맞게 아래와 같이 설정 한다.
eng) setting web.xml file (set it according to the http status code)
example web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<error-page>
<error-code>404</error-code>
<location>/error/404.jsp</location>
<!-- full path except context root -->
</error-page>
</web-app>
2. error jsp파일을 만든다
eng) make error jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" isErrorPage="true"%>
<%
response.setStatus(200);
//http status code 를 200 으로 맞춰서 error 를 유추하지 못하게
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>404 Error</title>
</head>
<body>
404 error
</body>
</html>
'JSP' 카테고리의 다른 글
[ JSP ] xml 출력 (0) | 2018.01.28 |
---|---|
[ JSP ] Servlet Filter modify request body (0) | 2014.12.05 |
[ JSP ] Servlet Filter request , response dump (0) | 2014.08.06 |
[ JSP ] Servlet Filter 사용한 접근 제한 구현 (0) | 2013.05.21 |
[ Servlet ] Servlet Filter 사용법 (1) | 2013.05.14 |
댓글