Exception

Exception

  1. 페이지 지시자 이용

    • 예외 발생

      1
      2
      3
      4
      5
      <%@ page errorPage="errorPage.jsp"%>

      <%
      int i = 40/0;
      %?
    • 예외 페이지

      1
      2
      3
      4
      5
      6
      //반드시 true로 명시해야함
      //명시해야 exception객체 사용가능
      <%@ page isErrorPage="true"%>
      <% response.setStatus(200); %>

      <%= exception.getMessage() %>

  2. Web.xml파일 이용

1
2
3
4
5
6
7
8
<error-page>
<error-code>404</error-code>
<location>/error404.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error500.jsp</location>
</error-page>
Comments