JSP – Exception Implicit Object

JSP Exception Implicit Object

  • JSP exception object is an instance of javax.servlet.jsp.JspException.
  • This object is used in exception handling to print the error message.
  • But is only be used on that jsp page on which isErrorPage attribute is true.

welcome.jsp:

<html>
            <head>
                        <title>Exception handling example</title>
            </head>
            <body>
                        <%      
                                    out.print(10/0);
                        %>
            </body>
</html>

errorPage.jsp:

<%@ page isErrorPage=”true” %>
<html>
            <head>
                        <title>error page</title>
            </head>
            <body>
                        Occurred exception is: <%= exception %>                 
            </body>
</html>
Scroll to Top