<%@ page isErrorPage="true" import="java.io.*" %>

<!-- This error page demonstrates a JSP ErrorPage used for
     catching exceptions thrown in other JSP pages, it is
     used by the ThrowException.jsp page -->

<html>
<head><title>JSP Error Page</title></head>

<body bgcolor=#ffffff>

<font face="Helvetica">

<h2><font color=#FF0000>JSP Error Page</font></h2>
<hr>

<!-- Test that there is indeed an exception to report. 
     Otherwise, the ErrorPage throws an NPE. -->
 
<% if (exception != null) { %>
<p> An exception was thrown: <b> <%= exception %>

<p> With the following stack trace:
<pre>

<%
    ByteArrayOutputStream ostr = new ByteArrayOutputStream();
    exception.printStackTrace(new PrintStream(ostr));
    out.print(ostr);
%>
</pre>

<!-- This next block executes if this page is loaded without
     an exception. --> 
<% }

else  { %>
<p> <font color=#FF0000><b>Error Page Error:</b></font>
    Error Page was called with a null exception. 
    This happens if you request this page directly. It
    should only be served in response to an exception on 
    another JSP page.   
<% } %>


<p>
<hr>

</body>
</html>


