Donnie Hale wrote:
> I've seen that, but since the ActionServlet acts on the mapping instances
> rather than asking the mapping instances to operate on themselves, the
> flexibility to use custom mapping classes only goes so far.

In what way would you like them to act on themselves? Initially, the
ActionForward is a way to give a URI a logical name. The ActionServlet
asks for a path, and it is given a path in return. Of course, how that
path is generated is the ActionForward's business. It's really a type of
event object.

> I see the view rendering piece as one of the services which the
> ActionServlet would coordinate. The default would work as it does now, that
> is it would forward/redirect as specified by the ActionForward. A
> velocity-supporting service could build the context and merge with the
> template to complete the request (no forwarding/redirecting required). The
> name "ActionForward" has implications w.r.t. forwarding/including, so that
> may need addressed.

Would it be possible to provide the Velicity service as another servlet
in the application?

The ActionForward paths could then equate to a Velocity template. 

The VelocityAction would build the context, or gather the details
required to do do, and pass it to the VelocityServlet in the request.

This would be very like the current pattern, since JSPs are a type of
servlet being rendered by a service (i.e. Jasper) that Struts does not
control. So instead of forwarding to Jasper, we are forwarding to a
VelocityServlet.

Of course, it is also possible to equip an Action with the
Velocity-supporting services, and have it render the response, and
return null to the ActionServlet. But forwarding to a VelocityServlet
makes the most sense from a patterns perspective, since, technically,
the ActionServlet should not be handling this itself.

> That aounds great, as long as I don't have to use tags to interact with
> MessageResources.

The MessageResources are now exposed as a bean in the ServletContext,
and so anyone with a link to the ServletContext can access them,
including an Action or another Servlet. So, the Velocity Action could
ask for the text for a given token for a given locale (from the user's
session), and merge it into the template.

If someone wanted to take this class to the Commons, with the idea that
Struts, Velocity, and the i18n tags could all share it, I doubt that
anyone here would object.

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/struts/

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

Reply via email to