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]>

Reply via email to