I took advantage just this week of an exception being saved via
saveException. A place higher in the Struts call stack had turned the
exception into a "return null", so I couldn't tell why that was happening
until I pulled the exception out of the context and dumped its stack trace.

FWIW...

Donnie


> -----Original Message-----
> From: Dmitri Valdin [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, January 27, 2002 8:13 AM
> To: Struts Developers List
> Subject: Re: Throwing exceptions from within Struts tags
>
>
> The first way is not welcome for sure, since at that case the original
> exception would be lost
> (in case there was some, causing this somethingBad to happen)
> But I don't understand the reason for calling RequestUtils.saveException
> in second case. If we configure an error page in web.xml then we
> can access
> the exception just with *exception* variable which is defined on every jsp
> page.
> This error page would be a good place to log the exception as well.
> Please correct me if I am wrong.
>
> Dmitri Valdin
>
>
> > I noticed that there are two different ways in which exceptions
> are thrown
> > from within Struts tags. One way is like this:
> >
> >     if (somethingBadHappened) {
> >         throw new JspException(messages.getMessage(...));
> >     }
> >
> > and the other is like this:
> >
> >     if (somethingBadHappened) {
> >         JspException e = new JspException(messages.getMessage(...));
> >         RequestUtils.saveException(pageContext, e);
> >         throw e;
> >     }
> >
> > I'm guessing that the first is "the old way" and the second is "the new
> > way", and that I should use the latter when writing new code (and
> > potentially when updating existing code). Is this correct?
> >
> > Also, is there a reason we throw JspException instead of
> JspTagException?
> >
> > Thanks!
> >
> > --
> > Martin Cooper
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
> >
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to