<%-- Copyright (c) 2002 Atanion GmbH, Germany -- All rights reserved. -- $Id: errorPage.jsp 865 2004-04-30 18:02:34 +0200 (Fr, 30 Apr 2004) lofwyr $ --%><%@ page isErrorPage="true" import="java.io.*" %> <%! public static void printStackTrace(Throwable exception, JspWriter out) throws IOException { ByteArrayOutputStream ostr = new ByteArrayOutputStream(); if (exception != null) { exception.printStackTrace(new PrintStream(ostr)); out.print(ostr); } else { out.print("<null>"); } } public static void handleException(Throwable exception, JspWriter out) throws IOException { if (exception == null) { return; } out.println("

Exception: " + exception + "

Stack trace:"); out.println("

");
    printStackTrace(exception, out);
    out.println("
"); Throwable nested = null; if (exception instanceof JspException) { JspException jspException = (JspException) exception; nested = jspException.getRootCause(); } else if (exception instanceof ServletException) { ServletException servletException = (ServletException) exception; nested = servletException.getRootCause(); } if (nested != null) { out.println("Nested exception:"); handleException(nested, out); } } %> Error Page

Error Page


<% if (exception == null) { exception = new Exception( "Exception unavailable! Tracing Stack..."); } handleException(exception, out); %>