ThrowException.jsp

<!-- Copyright (c) 1999 by BEA Systems, Inc. All Rights Reserved.-->

<!-- This JavaServer Page purposefully throws a NullPointerException
     that demonstrates using a JSP error page. (ErrorPage.jsp)
     ErrorPage.jsp must be installed in your WebLogic document root -->

<%@ page
    errorPage="ErrorPage.jsp"
    import="java.util.Vector"
%>

<html>
<head></head>

<%! Vector vec = null; %>

<body bgcolor=#ffffff>

<h2> Let's call a method on a null Vector...</h2>

Vector has <%= vec.size() %> elements.

</body>
</html>

-------------------------------------------------------------------------
ErrorPage.jsp

<!-- Copyright (c) 1999 by BEA Systems, Inc. All Rights Reserved.-->

<%@ page isErrorPage="true" %>

<!-- 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=#DB1260>JSP Error Page</font></h2>

<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>

<p>
<hr width=80%>

</body>
</html>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to