Amar,

I'd asked this question a while ago and was shown how to do this - you can
probably find the
original message in the archives.

I've included below the try/catch section I used to test the suggestion that
was sent to me.
It works, and essentially, the the JSP errorPage treats exceptions forwarded
in this manner
exactly as though received from another jsp page.  (The exception itself is
accessible in the
jsp page via the exception implicit object.

-AMT

----------------------------------------------------------------------------
----------------------
try {
    Integer.parseInt("Make Servlet Integer Parsing Error"); // Should throw
exception
} catch (Exception e) {
        request.setAttribute("javax.servlet.jsp.jspException", e);

getServletContext().getRequestDispatcher(<errorPageURL>).forward(request,
response);
}

> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Nanduri Amarnath
> Sent: Thursday, January 06, 2000 12:57 PM
> To: [EMAIL PROTECTED]
> Subject: Forwarding an exception from a Servlet onto a Jsp page
>
>
> Hi,
>      A jsp page submits data to a Servlet. The servlet uses beans
> to process
> requests and talk to databases. If any error occurs deep in the
> heirarchy, i am
> throwing it to the top most level, and finally gets caught by the
> Servlet. I am
> using a RequestDispatcher to forward to an error page. How do i pass this
> exception to the error page ( a jsp page ) so that i can display the error
> appropriately ?   I am using JSP1.0 and servlet api 2.1.
> One way of doing it is to keep the handle in a session object. Is there a
> cleaner way ?Thanks a lot.
>
> cheers,
> Amar..
>
>
>
>
>
>
>
> Steve Nguyen <[EMAIL PROTECTED]> on 01/06/2000 12:35:03 PM
>
> Please respond to Steve Nguyen <[EMAIL PROTECTED]>
>
>
> To:   [EMAIL PROTECTED]
> cc:    (bcc: Amarnath Nanduri/IT/VANCPOWER)
>
> Subject:  Re: Windows 2000 & IIS 5.0 & servlet ( Jrun support )
>
>
>
>
> Yaeh...that combination would work extremely well.
>
> Steve
> ----- Original Message -----
> From: ahmad abediny <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, January 06, 2000 10:38 PM
> Subject: Windows 2000 & IIS 5.0 & servlet ( Jrun support )
>
>
> >    Hi,
> >
> >     I have IIS 5.0 in my server . Can I use JRun for
> > writing Servlet and JSP ? If cannot help me .
> >
> > Thanks
> >
> > Ahmad Abediny
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Talk to your friends online with Yahoo! Messenger.
> > http://im.yahoo.com
> >
> >
> ==================================================================
> =========
> > 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
>
> ==================================================================
> =========
> 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