How Will You Implement Error Page in JSP ?

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 "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” %>



You May Interest

Enumeration and Iterator, Which One Has Better Performance in Jav ...

What is the Importance of hashCode and equals Methods in Java ?

How remove Method is Implemented in a HashMap in Java ?

What are the Differences Between Internal and External Iterator i ...

What are the Rules of Method Overloading and Method Overriding in ...