Alireza,
Nice idea. I haven't used errorPage much. I learned something new today.
Thanks,
Richard
At 05:19 PM 8/30/01 -0400, you wrote:
>Hi Richard,
>Your idea about using session variable leaded me to another solution. On top
>of each page I add <%@ page errorPage="error.jsp?jspfile=a.jsp" %> (b.jsp,
>c.jsp, ... ) then in error.jsp I read jspfile parameter and pass it to my
>email.
>
>Thank you.
>
>-----Original Message-----
>From: A mailing list about Java Server Pages specification and reference
>[mailto:[EMAIL PROTECTED]]On Behalf Of Richard Yee
>Sent: Thursday, August 30, 2001 3:51 PM
>To: [EMAIL PROTECTED]
>Subject: Re: jsp error page in email
>
>
>Alireza,
>Why don't you put a string in the session that indicates the current JSP
>page. The error page can then retrieve this value and display it in the
>email. You would need to have code such as this
>session.setAttribute("lastPage",request.getRequestURI());
>at the beginning of every JSP page.
>
>-Richard
>
>At 03:44 PM 8/30/01 -0400, you wrote:
> >Hi Richard,
> >I have couple of jsp pages with page directive <%@ page
> >errorPage="error.jsp" %> so erro.jsp is my error page.
> >I do all exception handling in this page. I make the required email body in
> >this page and pass it to an email java method with the exception object.
> >
> >
> >--- A.jsp program ---
> >..
> ><%@ page errorPage="error.jsp" %>
> >..
> ><% try { %>
> >...
> >... ...
> >....
> ><% } finally {
> > }
> >%>
> >----------------------
> >
> >---- error.jsp ------
> >...
> ><%@ page language="java" isErrorPage="true" %>
> >...
> ><% String errorMsg = "....." + "\nRequest URI : " +
> >request.getRequestURI();
> >
> >EmailTools.sendEmail ( ..., ..., errorMsg, excption );
> >-------------------
> >
> >So, if any error happens in A.jsp then error.jsp will be invoked and I need
> >to pass A.jsp as part of errorMsg to email program. hope it's clear.
> >
> >Thank you.
> >
> >
> >-----Original Message-----
> >From: A mailing list about Java Server Pages specification and reference
> >[mailto:[EMAIL PROTECTED]]On Behalf Of Richard Yee
> >Sent: Thursday, August 30, 2001 2:57 PM
> >To: [EMAIL PROTECTED]
> >Subject: Re: jsp error page in email
> >
> >
> >Alireza,
> >Is the email program a JSP page? Can't you pass the return value of
> >getRequestURI() to the error JSP page the same way you are passing the
> >exception object? Can you explain the flow of your web application so I
> >can understand the problem better?
> >
> >-Richard
> >
> >
> >
> >At 02:45 PM 8/30/01 -0400, you wrote:
> > >Hi Richard,
> > >In case of error I pass the exception object to email program, here after
> > >opening stream for the email body I could easily include the stack
>content
> > >using the method you mentioned.
> > >
> > >The getRequestURI() method returns the name of the jsp error page but I
> >need
> > >to get the name of the page which caused the error. Any comment
> >appreciated.
> > >
> > >Thank you,
> > >
> > >-----Original Message-----
> > >From: A mailing list about Java Server Pages specification and reference
> > >[mailto:[EMAIL PROTECTED]]On Behalf Of Richard Yee
> > >Sent: Thursday, August 30, 2001 12:42 PM
> > >To: [EMAIL PROTECTED]
> > >Subject: Re: jsp error page in email
> > >
> > >
> > >Alireza,
> > >You can get it from the getRequestURI() method from the request object.
> > >
> > >By the way, what did you end up doing to get the stack trace as part of
>the
> > >email? Can you include the code snippet?
> > >
> > >-Richard
> > >
> > >
> > >At 11:45 AM 8/30/01 -0400, you wrote:
> > > >Thank you Richard, it worked fine.
> > > >Is there any way to get the name of jsp file in which the error
>happened
> >in
> > > >an error page?
> > > >Thank you.
> > > >
> > > >-----Original Message-----
> > > >From: A mailing list about Java Server Pages specification and
>reference
> > > >[mailto:[EMAIL PROTECTED]]On Behalf Of Richard Yee
> > > >Sent: Wednesday, August 29, 2001 4:31 PM
> > > >To: [EMAIL PROTECTED]
> > > >Subject: Re: jsp error page in email
> > > >
> > > >
> > > >Alireza,
> > > >You can try outputting the stack trace to a temporary file using
> > > >printStackTrace(PrintStream) and then attaching that file to your
> > > >email. You could also read the contents of the file back into the body
> >of
> > > >your email message.
> > > >
> > > >-Richard
> > > >
> > > >At 04:12 PM 8/29/01 -0400, you wrote:
> > > > >Hi All,
> > > > >In my jsp error page I am sending en email to administrator
>mentioning
> > >the
> > > > >error. Is there any way to send the trace stack to
> > > > >this email?. exception.printStackTrace(...) show the stack on the
> >screen
> > > > >with void return value . Is there any other way to get this stack.
> > > > >
> > > > >Thank you,
> > > > >
> > > >
> > >
> >
> >===========================================================================
> > > > >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > > > >JSP-INTEREST".
> > > > >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > > >DIGEST".
> > > > >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
> > > >
> > >
> >
> >===========================================================================
> > > >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > > >JSP-INTEREST".
> > > >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > > >DIGEST".
> > > >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
> > > >
> > >
> >
> >===========================================================================
> > > >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > > >JSP-INTEREST".
> > > >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > >DIGEST".
> > > >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
> > >
> >
> >===========================================================================
> > >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > >JSP-INTEREST".
> > >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > >DIGEST".
> > >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
> > >
> >
> >===========================================================================
> > >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > >JSP-INTEREST".
> > >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> >DIGEST".
> > >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
> >
> >===========================================================================
> >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> >JSP-INTEREST".
> >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> >DIGEST".
> >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
> >
> >===========================================================================
> >To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> >JSP-INTEREST".
> >For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
>DIGEST".
> >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
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
>DIGEST".
>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
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
>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
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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