Casey,

Since the error pages do have access to your request implicit object, you
could,
as the first action on every non-error page, simply set an attribute of your
request with a label identifying the page as the value of the attribute.

If an error occurs, this value can be extracted by the error page from the
request
object to identify where the error occurred.

-AMT

----------------------------------------------------------------------------
-------

Example....

----------------------------------------------------------------------------
-------

<%-- Page causing error: --%>
<%@ page errorPage="Error.jsp" import="java.util.*" %>

<%
        request.setAttribute("from", "JSP Error Page");
%>
<HTML>
<Head>
<Title> Generate JSP Error </Title>
</Head>

<%
        Integer.parseInt("Make JSP Integer Parsing Error"); // Should throw
exception
%>

</Html>

----------------------------------------------------------------------------
--------

<%-- Errorpage dealing with error: Error.jsp --%>
<%@ 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> Common Error Page for Servlets & JSPs </H1>
        <HR>

        <BR> <BR>

        This error was generated either in <%= originator %> 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.

        <BR> <BR>
<%
        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 Bragg, Casey
> Sent: Monday, January 17, 2000 11:20 AM
> To: [EMAIL PROTECTED]
> Subject: Error Page : Which page did I come from?
>
>
> Hello all!
>
>    Consider that page X.jsp contains a <%@ page errorPage="Y.jsp"%>
>
>    An exception occurs during processing of X.jsp.  Thus Y.jsp handles the
> exception.
>
>    Is there a way of determining in Y.jsp which page caused the exception
> (X.jsp)?
>
>    I tried the following to no avail <%@ page
> errorPage="Y.jsp?source=X.jsp"
> %>.  In other words, passing the source page as a parameter.  I guess that
> only makes sense as an HTTP request though.
>
>    Any ideas?  I'm wanting to know if there is something built in to
> ServletRequest or someplace like that.  I'm sure there are lots of custom
> solutions.
>
>    By the way, I'm running JServ 1.1b1, GNUJSP 1.0, JSDK 2.0.
>
>    Thanks,
>
>    Casey
>
> ==================================================================
> =========
> 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