If you're wanting a JSP error page to be shown, why not just throw the
exception in the bean (or, in this case maybe re-throwing a different kind
of exception than the original one) and allow the JSP engine to
automatically forward to your JSP error page?
This doesn't require any extra scriptlet code, and your bean doesn't contain
any servlet level code. In general, I think it's a bad practice to put
servlet level code into JSP beans anyway because the beans are one degree
removed from the servlet flow of execution, and thus you run into the kind
of problem that you're having.
David
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Scott Douglass
> Sent: Thursday, November 04, 1999 8:11 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Taglib Question (SKIP_PAGE, RequestDispatcher.forward() and
> Beans)
>
>
> My opinion: Accept that you will have to add more Java code to
> your JSP and handle
> the exception there. Though it further breaks down the
> "presentation" only concept
> of JSP, I think it makes sense to handle exceptions where the
> methods are called.
> To do anything real you've got to add tons of code to the JSP
> anyway (after all,
> JSP is really a servlet disguised as an HTML file.) --Scott
>
> Neal Kaiser wrote:
>
> > I have a problem that I was hoping writing a custom tag would solve...
> >
> > I have a jsp page, which uses a bean. This bean can catch an
> exception, and
> > use a RequestDispatcher.forward()
> > to an ErrorHandler JSP. Even though I have a return statement after the
> > forward() in the bean, it returns control
> > back to the original JSP (unlike a return statement in a JSP
> which returns
> > from the service method). This follows the spec...but it also breaks my
> > application. The ErrorHandler page is shown, but control
> continues back to
> > the original JSP.
> >
> > Anyways, rather then setting attributes and checking for attributes (to
> > detect if there was a forward to ErrorHandler) I thought I could write a
> > custom <abort> tag which would stop the control by returning
> SKIP_PAGE from
> > the doEndTag() method....
> >
> > This does stop any content after the <abort> tag on the ErrorHandler.jsp
> > page, however, just like the bean, it returns control back to
> the first JSP
> > that was called. Is this per spec? Am I out of luck with a
> clean solution
> > to this?
> >
> > Thanks,
> > Neal
> >
> >
> ==================================================================
> =========
> > 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