You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Alan D. Cabrera" <li...@toolazydogs.com> on 2011/05/15 17:11:04 UTC
Chained actions and their properties in the value stack
I have a st of chained actions, in order A, B, C.
A has a getter for Foo. B does not have a getter/setter for Foo. C has a setter for Foo. It seems that A cannot provide C the value of Foo without B also "participating" and implementing a getter/setter for Foo. Yuck.
Do I understand things correctly or have I configured my chain incorrectly?
Regards,
Alan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Chained actions and their properties in the value stack
Posted by "Alan D. Cabrera" <li...@toolazydogs.com>.
On May 15, 2011, at 9:23 AM, Dave Newton wrote:
> On Sun, May 15, 2011 at 12:10 PM, Alan D. Cabrera wrote:
>> A knows how to find/generate instances of Foo.
>> B knows how to find/generate instances of Bar.
>> C is an application specific Action that needs an instance of Foo and an instance of Bar.
>
> A & B are application-specific actions too. Without knowing more, to
> me it sounds more like C should rely on services instead of actions A
> & B, removing the strong dependency on the web layer that has been
> introduced by the chaining.
Yeah, I see that subtle but important difference now. This should all be done in the service layer and not on the web layer. Looking at my setup I now see that I have service provisioning information spread in both spring and struts2 xml files, yuck.
Regards,
Alan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Chained actions and their properties in the value stack
Posted by Dave Newton <da...@gmail.com>.
On Sun, May 15, 2011 at 12:10 PM, Alan D. Cabrera wrote:
> A knows how to find/generate instances of Foo.
> B knows how to find/generate instances of Bar.
> C is an application specific Action that needs an instance of Foo and an instance of Bar.
A & B are application-specific actions too. Without knowing more, to
me it sounds more like C should rely on services instead of actions A
& B, removing the strong dependency on the web layer that has been
introduced by the chaining.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Chained actions and their properties in the value stack
Posted by "Alan D. Cabrera" <li...@toolazydogs.com>.
On May 15, 2011, at 8:34 AM, Dave Newton wrote:
> On Sunday, May 15, 2011, Alan D. Cabrera wrote:
>> I have a st of chained actions, in order A, B, C.
>
> Jason's correct--IMO action chaining is more trouble than it's worth,
> almost always. *Three* in a chain?! What's the use case for this?
Yeah, I could have fallen into an anti-pattern here.
Let's say that A knows how to find/generate instances of Foo. B knows how to find/generate instances of Bar. C is an application specific Action that needs an instance of Foo and an instance of Bar.
>> A has a getter for Foo. B does not have a getter/setter for Foo. C has a setter for Foo. It seems that A cannot provide C the value of Foo without B also "participating" and implementing a getter/setter for Foo. Yuck.
>
> Why "yuck"? You'd like the actions in the chain to be coupled even
> *more* tightly and rely on hidden magic to maintain state between
> them, beyond what's already provided?
B should only be concerned with finding/generating instances of Bar and not worry about "passing up" values from A.
Regards,
Alan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Chained actions and their properties in the value stack
Posted by Dave Newton <da...@gmail.com>.
On Sunday, May 15, 2011, Alan D. Cabrera wrote:
> I have a st of chained actions, in order A, B, C.
Jason's correct--IMO action chaining is more trouble than it's worth,
almost always. *Three* in a chain?! What's the use case for this?
> A has a getter for Foo. B does not have a getter/setter for Foo. C has a setter for Foo. It seems that A cannot provide C the value of Foo without B also "participating" and implementing a getter/setter for Foo. Yuck.
Why "yuck"? You'd like the actions in the chain to be coupled even
*more* tightly and rely on hidden magic to maintain state between
them, beyond what's already provided?
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Chained actions and their properties in the value stack
Posted by "Alan D. Cabrera" <li...@toolazydogs.com>.
On May 15, 2011, at 8:25 AM, Jason Pyeron wrote:
>> -----Original Message-----
>> From: Alan D. Cabrera [mailto:list@toolazydogs.com]
>> Sent: Sunday, May 15, 2011 11:11
>> To: user@struts.apache.org
>> Subject: Chained actions and their properties in the value stack
>>
>> I have a st of chained actions, in order A, B, C.
>
> FYI: http://struts.apache.org/2.x/docs/action-chaining.html
Ahh, since "Actions should be treated as a Transaction Script, rather than as methods in aBusiness Facade" I have fallen into an anti-pattern.
Regards,
Alan
RE: Chained actions and their properties in the value stack
Posted by Jason Pyeron <jp...@pdinc.us>.
> -----Original Message-----
> From: Alan D. Cabrera [mailto:list@toolazydogs.com]
> Sent: Sunday, May 15, 2011 11:11
> To: user@struts.apache.org
> Subject: Chained actions and their properties in the value stack
>
> I have a st of chained actions, in order A, B, C.
FYI: http://struts.apache.org/2.x/docs/action-chaining.html
>
> A has a getter for Foo. B does not have a getter/setter for
> Foo. C has a setter for Foo. It seems that A cannot provide
> C the value of Foo without B also "participating" and
> implementing a getter/setter for Foo. Yuck.
>
> Do I understand things correctly or have I configured my
> chain incorrectly?
Sounds like an anti pattern to me, but you should be able to get your values
from
http://struts.apache.org/2.2.1/struts2-core/apidocs/com/opensymphony/xwork2/Acti
onContext.html#getValueStack()
Write back with more specific goals and maybe I can give more targeted advise.
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- -
- Jason Pyeron PD Inc. http://www.pdinc.us -
- Principal Consultant 10 West 24th Street #100 -
- +1 (443) 269-1555 x333 Baltimore, Maryland 21218 -
- -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org