On Wed, 6 Jun 2001, Dan - Blue Lotus Software wrote:
>
> Of course, the Servlet 2.3 spec hasn't been finalized yet. But Tomcat
> Catalina (in it's 5th beta release) implements Filters. They're really
> cool, and they might make the ActionServlet concept a bit redundant. That
> is, the controller in an MVC/Model 2 architecture can be implemented as a
> Filter.
>
Since I'm in the expert group for Servlet 2.3 (and wrote all the Tomcat 4
code that supports filters), I've thought about this one a lot. And,
truth be told, I'd probably still do the controller as a servlet, even if
I was starting from a 2.3 baseline.
The primary reason for this thinking is that filters cannot "redirect" the
flow of control to different servlets (i.e. different actions in Struts
terminology). The servlet that is going to be executed has already been
selected by the container, based on the original request URI. Given that
you're going to end up executing *some* servlet anyway, you're still faced
with the choice of a single dispatching servlet (which the Struts
controller already does) or implementing each action as a separate servlet
(which, among other things, is quite a lot harder to set up).
> Just my 2p worth.
>
> -dan
Craig McClanahan