On the subject of Exceptions in the Model II (MVC) JSP architecture - is
there some recommended way to handle Exceptions thrown within the
controller servlet from the presentation point of view? it seems that
the errorPage
attribute of the <%@ page> tag in the page that the request is forwarded
to is ignored because the Exception is thrown outside of the page
context.

The only way to use this error page seems to be to wrap the exception in
a JspException, and put it in the request via a setAttribute() method
call and forward to the error page - not pretty.

Any suggestions? How do others manage Exception handling in Model II?

Damian

Slava Kozlov wrote:
>
> BTW,
>
> Since we're writing out interfaces, I recommend that WebActions throw
> WebActionExceptions not (or at least, not only) the lower-level
> ServletException and IOException. The reasons are double-fold:
>
> Encapsulation:
>         Depending upon your design (which class processes error code?), maybe the
> controller servlet shouldn't need to know about low-level details such as
> when a WebAction was unable to open a file. After all, that's the
> WebAction's business. Let it catch these exceptions and deal with them and
> only throw the controller exceptions at "its" level.
>
> Extensibility:
>         There may be times when a WebAction fails without it being a Servlet or an
> IOException. There are tons of examples, database not accessible, or
> security problem or, etc. Changing the signature to account for these is I
> think necessary.
>
> -s
>
> ===========================================================================
> 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

--
Damian Fauth              Fairfax Interactive Network (F2)
Senior Software Engineer                 201 Sussex Street
Ph: +61 2 9282 3528                      Sydney  NSW  2000
[EMAIL PROTECTED]          http://www.f2.com.au

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

Reply via email to