Header Ads

  • Breaking Now

    How will you handle runtime exceptions in your JSPs?

    JSP runtime exceptions are handled through the implicit object named "exception". This exception object can be used in a special type of JSP page called an error page, where you display the exception's name and class, its stack trace, and an informative message for your user.
    In any JSP which is made eligible for catching exceptions then it must have a mention to error page in @page directive,something like:

    <%@ page errorPage="ErrorHandling.jsp" %>

    The error page, in this case ' ErrorHandling.jsp', has 'isErrorPage' attribute in page directive which should be set to true. When a JSP page has been declared an errorPage, it is made available an object with name of "exception" of type java.lang.Throwable.

    Post Top Ad

    Post Bottom Ad