Ravi,

Here is an example.  Hope this helps.

-AMT

----------------------------------------------------------------------------
---------
<%-- PageName: ErrorJSP.jsp
     ^^^^^^^^^^^^^^^^^^^^^^

        This page generates a JSP error.  Note that the errorPage parameter to the
        page directive identifies the relative path to the error page.
--%>
<%@ page errorPage="Error.jsp" import="java.util.*" %>

<HTML>
<Head>
<Title> Generate JSP Error </Title>
</Head>

<%
        request.setAttribute("from", "JSP Error Page");
        Integer.parseInt("Make JSP Integer Parsing Error"); // Should throw
exception
%>

</Html>
----------------------------------------------------------------------------
---------
<%-- PageName: Error.jsp
     ^^^^^^^^^^^^^^^^^^^

        This page is a JSP Error page.  Note that the isErrorPage parameter to the
        page directive identifies this page as an error page.  (This allows use of
the
        implicit exception object.)
--%>

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

<% String originator = (String) request.getAttribute("from"); %>

<HTML>
<Head>
<Title> Common Error Page for Servlets & JSPs </Title>
</Head>

<BODY>

        <H1 ALIGN=center> Error Page for JSPs </H1>
        <HR>

        <BR><BR>

        Error Generated in <U><%= originator %></U>.

        <BR> <BR>

        This error was generated either in a JSP (identified above)
        by attempting to parse a string as an integer.  The string used for this
        purpose was NOT a string representation of an integer, so a NumberFormat
        Exception was raised. For a real application, this page could include a
        means to contact customer support, or simply to report, by email,
reoccuring
        exceptions.  (Only unexpected exceptions would result in the use of
        this page.)

        <BR><BR>
        <HR>

        <B> <%= exception.toString() %> </B>

        <BR><BR>

        <PRE>
<%
        PrintWriter p = new PrintWriter(out, true); // Create PrintWriter with
JSPWriter
        exception.printStackTrace(p);               // Use PrintWriter for output
%>
        </PRE>

</BODY>

</Html>
----------------------------------------------------------------------------
---------

> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Ravindranath Yagatili
> Venkata
> Sent: Friday, February 11, 2000 1:25 PM
> To: [EMAIL PROTECTED]
> Subject: Error Page
>
>
> Hi ,
> I would like to use the error page directive and would like to
> know if some
> one can send me working code of it or show me some examples....
>
> Thanks & Regds,
> Ravi
>
> ==================================================================
> =========
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> FAQs on JSP can be found at:
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to