Re: action to action with form

2004-11-24 Thread Bill Keese

 So, I have actioclass A and I want to call action class B witch needs
 actionform C.
 I will use the mappings to chain the response from B to my first
 action class A.

http://wiki.apache.org/struts/ForwardingWithDifferentParameter

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

RE: action to action with form

2004-11-19 Thread Robert Taylor
You shouldn't be calling an Action from an Action.
Action chaining is not recommended and is considered
poor practice. Action classes are an implementation of
Command pattern and as such should delegate to reusable
business components. 

I would refactor your business logic embedded in Action classes
into business components or application services. You can
then call these from any Action class and they will be easier
to unit test.

If you want Struts to provide the ActionForm for each action then
you must bind the ActionForm to the Action class in the action mapping.
So if Actions, A, B, and C all need ActionFormC then you will have
to define this in the struts-config.xml file. One way of maintaining
state across actions is to place the ActionForm in session scope.

robert

 -Original Message-
 From: Raffe Paffe [mailto:[EMAIL PROTECTED]
 Sent: Friday, November 19, 2004 7:18 AM
 To: [EMAIL PROTECTED]
 Subject: action to action with form
 
 
 
 Hi
 
 I have a system with some action classes that i need to call from my action 
 class.
 I do not have the source code of the action classes that needs to be called 
 and I
 can not change them but I know how the actionform is suppose to look and I 
 want
 to this serverside.
 
 So, I have actioclass A and I want to call action class B witch needs 
 actionform C.
 I will use the mappings to chain the response from B to my first action 
 class A.
 
 Can I do this and if yes, how? Can I create actionform C and chain it 
 somehow?
 
 Code examples woulde be great.
 
 Thanks
 
 Ralf
 
 
 Good judgement comes from experience, and experience comes from bad 
 judgement.
 
 _
 FREE pop-up blocking with the new MSN Toolbar - get it now! 
 http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

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



re: action to action with form

2004-11-19 Thread Raffe Paffe
You shouldn't be calling an Action from an Action.
Action chaining is not recommended and is considered
poor practice. Action classes are an implementation of
Command pattern and as such should delegate to reusable
business components.
I would refactor your business logic embedded in Action classes
into business components or application services. You can
then call these from any Action class and they will be easier
to unit test.
Yes, very true, but i dont have the spource code of the actionclass I am 
calling
so I cant refactor och do what you suggest.

If you want Struts to provide the ActionForm for each action then
you must bind the ActionForm to the Action class in the action mapping.
So if Actions, A, B, and C all need ActionFormC then you will have
to define this in the struts-config.xml file. One way of maintaining
state across actions is to place the ActionForm in session scope.
AFAIK the action that i want to call gets its parameters from the ActionFrom 
so
thats why I want to create it , set some vaiables and send it to the 
reciving action class.
Can I do this and if so how?

Thanks for your answer.
Ralf
_
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

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