JSP
errorPage , isErrorPage
당근개발자
2021. 5. 3. 00:10
example3.jsp
<%@ page contenteType ="text/html;charset=UTF-8"%>
<% page isErrorPage ="true" %>
<html>
<head>
<title>예외상황 처리 </title>
</head>
<body>
<h4>다음과 같은 에러가 발생하였다.</h4>
에러타입 :
<%=exception.getClass().getName() %>
<br> 에러 메세지 :
<%= exception .getMessage() %>
</body>
</html>
- 이 페이지는 에러처리 페이지임을 뜻한다.
example4.jsp
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page errorPage = "example3.jsp" %>
<%
String param = request.getParameter("id");
if(param.equals("test"))
param = "파라미터가 입력되었습니다. (예외사항이 발생하지 않았습니다 !)";
%>
<html>
<body>
<h4>
<%=param%>
</h4>
</body>
</html>