On Sat, 26 Jan 2002, Martin Cooper wrote:

> Date: Sat, 26 Jan 2002 22:39:28 -0800
> From: Martin Cooper <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: Struts Developers List <[EMAIL PROTECTED]>
> Subject: Throwing exceptions from within Struts tags
>
> 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?
>

Yes.

> Also, is there a reason we throw JspException instead of JspTagException?
>

Historical sloth on my part.  :-)

Now that it's been done for a long time, I would not suggest changing the
habit, since existing apps might be depending on the current behavior.

> Thanks!
>
> --
> Martin Cooper
>

Craig


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

Reply via email to