Error page looks like this:
<%@ page contentType="text/html" %>
<%@ page isErrorPage="true" %>
<html>
<link rel="stylesheet" type="text/css" href="../monstyle.css">
<h1>Sorry! an error has occured.</h1>
<blockquote>
Error message:<%= exception.getMessage() %><br>
Java exception:<%= exception.toString() %><br>
JSP requested:<%=request.getServerName()+request.getRequestURI() %><br>
</blockquote>
<% System.out.println("jsp_error_page: Error in JSP: " + request.getServerName()
+ request.getRequestURI() + ". Exception was: "+exception.toString()); %>
<h2>Please contact support.</h2>
</html>
Page creating the error:
<%@ page contentType="text/html" %>
<%@ page errorPage="/MonError.jsp" %>
<%@ page import="java.util.*" %>
<html>
<link rel="stylesheet" type="text/css" href="../monstyle.css">
<body>
<h2>Group List</h2>
<table cellpadding="0" cellspacing="0">
<tr>
<th>Group Code</th>
<th>Group Description</th>
<th>Edit</th>
<th>Delete</th>
<th>Copy</th>
</tr>
<jsp:useBean id="mglb" scope="request" class="com.primur.monitor.MonGroupListBean"/>
<%
String rowStyle = "tr1";
Vector grouplist = (Vector)request.getAttribute("grouplist") ;
for (Enumeration e = grouplist.elements() ; e.hasMoreElements()
{
mglb =(com.primur.monitor.MonGroupListBean)e.nextElement();
%>
<tr class="<%=rowStyle %>">
<td> <a title="View" href="MonGroupMaint?mode=view&id=<%= mglb.getGrgrpc() %>">
<%= mglb.getGrgrpc() %></td>
<td><%= mglb.getGrdesc() %></td>
<td>
<p align="center">
<a href="MonGroupMaint?mode=edit&id=<%= mglb.getGrgrpc() %>">
<img border="0" src="../edt.gif" width="22" height="20" alt="Edit"></a></td>
<td>
<p align="center">
<a href="MonGroupMaint?mode=delete&id=<%= mglb.getGrgrpc() %>">
<img border="0" src="../del.gif" width="22" height="20" alt="Delete"></a></td>
<td>
<p align="center">
<a href="MonGroupMaint?mode=copy&id=<%= mglb.getGrgrpc() %>">
<img border="0" src="../cpy.gif" width="22" height="20" alt="Copy"></a></td>
</tr>
<%
if (rowStyle=="tr1"){
rowStyle = "tr2";
}
else {
rowStyle = "tr1";
}
}
<%
if (true)
throw new Exception("This is my test"); //
test error page
%>
%>
</table>
<p></p>
<a href="MonGroupMaint?mode=add">Add New User</a>
</body>
<html>
The error page appears in a cell of the page's table.