Andy wrote:
Having my s2 action classes implement ServletRequestAware works great
> for getting request parameters.
It's not necessary, though, as S2 will set request parameters into
action properties (a) without the overhead of getting the request
parameters manually, and (b) without tying your action to the servlet spec.
> However it doesn't look like non-action classes can implement
> this interface to get the parameters.
S2 doesn't know anything about your "non-action" classes, and has no
magic discovery path with which to identify them.
Since I offload my action class execute() processing to a service
> class (which is injected into the action via spring), I would like
> the service class to have access to the request parameters. Is
> the only way to accomplish this to pass the parameters reference
> from the action to the service class? I was hoping to have the
> parameters somehow injected into the service class.
I'm not sure you're making use of S2 the way (or at least one major way)
it was intended to be used. In general the meme is to have the
parameters set into the action via action properties. The action then
calls the injected service, passing the properties in a service method call.
That said, there's no reason the property setting can't be done in a
single call via something like commons-beanutils--assuming the service
is either synchronized or otherwise thread-safe. It's been my experience
that services are generally singletons (via Spring), making this a Bad Idea.
YMMV.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org