To implement an error-handling page in JSP, we first create a JSP with error page handling information. In most of the cases we gracefully handle error by giving a user-friendly message like “Sorry! There is system error. Please try again by refreshing page.”
In this error page, we show user-friendly message to user, but we also log important information like stack trace to our application log file.
We have to add parameter isErrorPage=true in page directive of this page. This tells to JSP container that this is our error page.
<%@page isErrorPage=”true” %>
Now we can use this error page in other JSP where we want to handle error. In case of an error or exception, these JSP will direct it to errorPage.
<% page errorPage=”ErrorPage.jsp” %>Read the full book at www.amazon.com