Andy Law wrote:



Jeromy,

That's enormously helpful - thanks.

A short follow-up. Can you point me towards a description of where/when the
Action object gets created and where Interceptors fit into the process.


The architect's guide is a good place to start.
http://struts.apache.org/2.0.11.2/docs/big-picture.html

There's nothing better than a good book though.

I need to understand how I'm going to get the leading part of the URL into
the action object and my head really, really hurts right now... :o}. I'm
wondering if an interceptor might be a better, more understandable (to me)
option?

If I'm reading things right as of now, the ActionMapper route will fire (and
complete) before the Action object is created (since the ActionMapper
decides *which* Action gets created) so my options there are to put the
details of what I find in the URL path into the request object where it can
be pulled by the Action (which makes testing slightly harder), whereas an
Interceptor allows me to just magic the details into the Action. On the
other hand, the Interceptor requires a signature on the Action which could
be overruled with a Parameter in the URL?


Creating a custom interceptor or custom action mapper is a fine way to go about it. The ParametersInterceptor is responsible for setting properties of your action from params in the request. There's also two other ParametersInterceptor variations; one that sets static parameters defined in struts.xml, and another that sets parameters created by the ActionMapper.

You could also create your own interceptor that checks if your action implements a particular interface, and if so, extract some information from the request and sets a property.

The plugins I mentioned previously do that for you in their own ways but if none are suitable then I'd probably create a custom ActionMapper that exends the default but also looks for that param in the URI and returns it in the parameter map of the ActionMapping.

Hope that makes sense.
regards,
Jeromy Evans





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

Reply via email to