Title: RE: Using Error Pages from servlets

>(You will run into some
> minor issues apropos the visibility of the session object (usually
> created within a service() method), but you can get around it
> nevertheless)

What kind of problem ?

>
> But if you want the servlet to call the *JSP error page*, you *have*
> to place the throwable object within the request object,
>......

Got it ! I didn't realise the author was talking about *JSP error page*.

BTW would you not recommend having your own error handling page so that you have more control as to what and how you want to display the error ?




> -----Original Message-----
> From: Govind Seshadri [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 15, 1999 1:21 PM
> To: Sachin Aggarwal
> Cc: [EMAIL PROTECTED]
> Subject: Re: Using Error Pages from servlets
>
>
> Sure, you can store the exception within the session object,
> call sendRedirect() within the exception handler, and forward it
> to *some* JSP page or servlet. (You will run into some
> minor issues apropos the visibility of the session object (usually
> created within a service() method), but you can get around it
> nevertheless)
>
> But if you want the servlet to call the *JSP error page*, you *have*
> to place the throwable object within the request object, tag
> it appropriately, and then perform a forward using a
> request dispatcher to the delegate error page. This is
> needed because the implicit "exception" object is
> created by doing a getValue() on the "javax.servlet.jsp.jspException"
> attribute expected within the request object.
>
> If the specified attribute in not located within the request, then
> the JSP engine usually throws an "Error: 500 Unknown Exception"
> error.
>
> Govind
> > Sachin Aggarwal wrote:
> >
> > What are the reasons for not using the following approach ?
> >
> > Save the exception as a session object and call sendRedirect on the
> > response object. This way you can redirect to a page even
> if you have
> > written to the printWriter.
> >
> > > -----Original Message-----
> > > From: Govind Seshadri [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, December 14, 1999 9:13 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Re: Using Error Pages from servlets
> > >
> > >
> > > Arun Thomas wrote:
> > > >
> > > > Hello all,
> > > >
> > > > Can anyone point me to a resource that shows how error
> > > pages can be used
> > > > from a servlet.
> > > > I've got an error page that I am using for exceptions
> > > generated in my jsp
> > > > pages, and
> > > > I'd like to use the same one for  servlet exceptions.
> > > Unfortunately, I
> > > > haven't been
> > > > able to find anyplace where the interface to an error page
> > > is spelled out.
> > > >
> > >
> > > See the jGuru JSP FAQ entry titled "Can I invoke a JSP error
> > > page from a
> > > servlet?" at:
> > >
> > http://www.jguru.com/jguru/faq/view.jsp?EID=1347
> >
> > Govind
> >
> > --
> > Govind Seshadri <[EMAIL PROTECTED]>
> > jGuru.com - Your Gateway to the Java Universe
> > http://www.jguru.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
>
> --
> Govind Seshadri <[EMAIL PROTECTED]>
> jGuru.com - Your Gateway to the Java Universe
> http://www.jguru.com
>

Reply via email to