You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mule_user <sg...@aol.com> on 2008/02/20 23:24:31 UTC

Struts1.1 - Value of ActionForm in second Action that is chained

This is the scenario using Struts 1.1:

User Interface -> MyAction1 (input is Form1)-> MyAction 2 (input is Form2)
->User Interface

MyAction1 and MyAction2 are Action classes.

MyAction1 and MyAction1 are configured in struts-config.xmxl.

MyAction1 takes Form1 as input.

MyAction2 takes Form2 as input.

Form1 and Form2 are ActionForms.

Following are the questions:

1. If Form1 and Form2 are of the same class, will Form2 get magically
populated by the values obtained from Form1, when Action1 forwards to
Action2?
2. Will Form2 values be empty?
3. If Form1 and Form2 are of different class, then what value will Form2
have?
4. If Form1 and Form2 are of the same class, then what value will Form2
have?
5. Is it a good idea to do Action chaining? Servlet chaining was never
recommended. 
-- 
View this message in context: http://www.nabble.com/Struts1.1---Value-of-ActionForm-in-second-Action-that-is-chained-tp15600395p15600395.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts1.1 - Value of ActionForm in second Action that is chained

Posted by Laurie Harper <la...@holoweb.net>.
mule_user wrote:
> This is the scenario using Struts 1.1:
> 
> User Interface -> MyAction1 (input is Form1)-> MyAction 2 (input is Form2)
> ->User Interface
> 
> MyAction1 and MyAction2 are Action classes.
> 
> MyAction1 and MyAction1 are configured in struts-config.xmxl.
> 
> MyAction1 takes Form1 as input.
> 
> MyAction2 takes Form2 as input.
> 
> Form1 and Form2 are ActionForms.
> 
> Following are the questions:
> 
> 1. If Form1 and Form2 are of the same class, will Form2 get magically
> populated by the values obtained from Form1, when Action1 forwards to
> Action2?
> 2. Will Form2 values be empty?

Provided it really is a forward and not a redirect then yes, I believe 
Action2's form will be populated the same as Action1's form was.

> 3. If Form1 and Form2 are of different class, then what value will Form2
> have?

Again assuming a forward, Form2 would get populated in the usual way, 
meaning that Form2 properties will be set if there are corresponding 
request parameters. The type of the form doesn't matter; it's the 
properties it defines that are significant.

> 4. If Form1 and Form2 are of the same class, then what value will Form2
> have?

That's the same question isn't it?

> 5. Is it a good idea to do Action chaining? Servlet chaining was never
> recommended. 

The simple answer is no; action chaining is considered an anti-pattern. 
That said, there are circumstances where it is appropriate, and there 
are people who disagree that it's an anti-pattern in the first place :-)

However, I would recommend that you avoid doing it entirely until you're 
sure you understand what's going on when a request is processed.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org