Explain how JSP handle run-time exceptions?
The errorPage attribute of the page directive can be used to redirects the browser to an error processing page, when uncaught exception is encountered.
For example:
<%@ page errorPage="error.jsp" %>
redirects the browser to the JSP page error.jsp if an uncaught exception is encountered during the request processing.
In error.jsp, if it’s indicated that it’s an error-processing page by <%@ page isErrorPage="true" %> directive, then throwable object describing the exception may be accessed within the error page via the exception implicit object.
How do you restrict page errors display in the JSP page?
a. Set "Errorpage" attribute of PAGE directory to the name of the error page (i.e Errorpage="error.jsp") in your jsp page.
b. In the error.jsp page, set "isErrorpage=TRUE".
Thus the occurrence of an error in the jsp page will automatically call the error page.