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

How Can You Determine If Your Program Has a Deadlock in Java ?

What is an Output Comment in JSP ?

How Can We Find the Memory Usage of JVM From Java Code ?

Creating a Map with Reverse View and Lookup in Java

What is Thread Starvation in Java ?