Display Error Message In Error Handling Page : Error Page « JSP « Java Tutorial






index.jsp

<%@ page errorPage="errorPage.jsp" %>
<HTML>
    <HEAD>
        <TITLE>Using the exception Object</TITLE>
    </HEAD>

    <BODY>
        <H1>Using the exception Object</H1>
        <%
            int value = 1;
            value = value / 0;
        %>
    </BODY>
</HTML>

errorPage.jsp

<%@ page isErrorPage="true" %>
<HTML>
    <HEAD>
        <TITLE>An Error Page Using the exception Object</TITLE>
    </HEAD>

    <BODY>
        <H1>An Error Page Using the exception Object</H1>
        An error occurred: <%= exception.toString() %>
    </BODY>
</HTML>
  Download:  DisplayErrorMessageInErrorHandlingPage.zip( 1 k)








23.30.Error Page
23.30.1.Error page
23.30.2.Provide Error Handling Page
23.30.3.Pass Message to Error Handling Page
23.30.4.Display Error Message In Error Handling Page