Custom error page

Technote (FAQ)
Problem
Example of error.jsp from Infocenter website does not compile.
Solution
The example error.jsp does not compile from the Infocenter website, 4.2.1.3.5.2 Example: JSP file for handiling application errors. The following code can be used to create a custom error page. The JSP processor must be 1.0 or 1.1.


<%@ page isErrorPage="true" %>
<jsp:useBean id="ErrorReport" class="com.ibm.websphere.servlet.error.ServletErrorReport" scope="request"></jsp:useBean>
<html>
<head><title>ERROR: <%= ErrorReport.getErrorCode() %></title></head>
<body>
<H1>An error has occured while processing the servlet named:
<%= ErrorReport.getTargetServletName() %></H1>

<B>Message: </B><%= ErrorReport.getMessage() %><BR>
<B>StackTrace: </B><%= ErrorReport.getStackTrace() %><BR>
</body>
</html>












Document Information

Product categories: Software, Application Servers, Distributed Application & Web Servers, WebSphere Application Server, Samples
Operating system(s): Multi-Platform
Software version: 3.5
Software edition: Standard, Advanced
Reference #: 1132621
IBM Group: Software Group
Modified date: 2003-08-28