> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Craig R. McClanahan
> Sent: Sunday, January 16, 2000 11:09 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Providing application resources to action classes in
> single-servlet delegation model
>
>

...

>     public interface WebAction {
>
>         public void perform(HttpServlet servlet,
>           HttpServletRequest req, HttpServletResponse res)
>           throws ServletException, IOException
>
>     }
>

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

Reply via email to