You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ch...@skillteam.com on 2003/07/10 17:40:54 UTC

Different actionforms pointing to the same action ?????

Hi,

Is it possible that an action is used with different actionforms ?
I explain. I would like to create a generic action (e.g. action to send an
email using the content fullfilled by a user in a form) which is not linked
to a particular actionform (e.g. registration form, cancellation form,
approval form). In this case, the action should retrieve from the
Actionform object, the properties (e.g. first name, last name, ...) using
introspection because those are not known inside the action. The properties
are different from objectform to objectform.


Met vriendelijke groeten - Cordialement - Best Regards,

Ir. Charles Moulliard
eBusiness Solutions Architect

SkillTeam NV, AV. Roodebeek - Roodebeeklaan 89 - 1030 Brussel
Tel    :  +32 (0)2 743 49 00
Fax    : +32 (0)2 743 49 01
GSM  : +32 0486 25 98 52
eMail  :  chm@SkillTeam.com


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


Re: Different actionforms pointing to the same action ?????

Posted by Jing Zhou <ji...@netspread.com>.
----- Original Message ----- 
From: <Ch...@skillteam.com>
To: <st...@jakarta.apache.org>
Sent: Thursday, July 10, 2003 10:40 AM
Subject: Different actionforms pointing to the same action ?????


> Hi,
>
> Is it possible that an action is used with different actionforms ?
> I explain. I would like to create a generic action (e.g. action to send an
> email using the content fullfilled by a user in a form) which is not
linked
> to a particular actionform (e.g. registration form, cancellation form,
> approval form). In this case, the action should retrieve from the
> Actionform object, the properties (e.g. first name, last name, ...) using
> introspection because those are not known inside the action. The
properties
> are different from objectform to objectform.

It is hard to have a generic action that is capable of dealing with
different types of form beans (or instances of ActionForm). However,
it is conceivable to have a generic action that deals with general events
and routing tasks at a high level.

>
>
> Met vriendelijke groeten - Cordialement - Best Regards,
>
> Ir. Charles Moulliard
> eBusiness Solutions Architect
>
> SkillTeam NV, AV. Roodebeek - Roodebeeklaan 89 - 1030 Brussel
> Tel    :  +32 (0)2 743 49 00
> Fax    : +32 (0)2 743 49 01
> GSM  : +32 0486 25 98 52
> eMail  :  chm@SkillTeam.com
>

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


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


Re: Different actionforms pointing to the same action ?????

Posted by Ted Husted <hu...@apache.org>.
I often use coarse-grained ActionForms that can serve a number of 
related actions. In practice, a common set of properties are used by 
different actions at different times. The difference is that each action 
will often have its own way of validating a subset of these properties.

If you are using the Struts Validator, you can use the same formbean 
(name property) for each action mapping and then use the mapping 
attribute property to give each action its own validation form.

Just remember that when the formbean is passed to the page, it will use 
the attribute property for its name (not the (sic) name name).

If you are not using the Struts Validator, and need different 
validations for different actions, then you can create a base ActionForm 
with the properties and subclass it with different validation methods.

If you are using DynaActionForms (but not the Validator), then create 
DynaActionForm subclasses with special validate methods and then specify 
those when defining your form-beans. (So, in this case, you would not 
need to use the attribute property in the mapping, just the name.)

-Ted.


Charles_Moulliard@skillteam.com wrote:
> Hi,
> 
> Is it possible that an action is used with different actionforms ?
> I explain. I would like to create a generic action (e.g. action to send an
> email using the content fullfilled by a user in a form) which is not linked
> to a particular actionform (e.g. registration form, cancellation form,
> approval form). In this case, the action should retrieve from the
> Actionform object, the properties (e.g. first name, last name, ...) using
> introspection because those are not known inside the action. The properties
> are different from objectform to objectform.
> 
> 
> Met vriendelijke groeten - Cordialement - Best Regards,
> 
> Ir. Charles Moulliard
> eBusiness Solutions Architect
> 
> SkillTeam NV, AV. Roodebeek - Roodebeeklaan 89 - 1030 Brussel
> Tel    :  +32 (0)2 743 49 00
> Fax    : +32 (0)2 743 49 01
> GSM  : +32 0486 25 98 52
> eMail  :  chm@SkillTeam.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 


-- 
Ted Husted,
   Junit in Action  - <http://www.manning.com/massol/>,
   Struts in Action - <http://husted.com/struts/book.html>,
   JSP Site Design  - <http://www.amazon.com/exec/obidos/ISBN=1861005512>.



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


Re: Different actionforms pointing to the same action ?????

Posted by Sandeep Takhar <sa...@yahoo.com>.
I wouldn't.  Each action should have one actionForm.

Maybe a coarse-grained one with all the properties?

sandeep
--- Charles_Moulliard@skillteam.com wrote:
> Hi,
> 
> Is it possible that an action is used with different
> actionforms ?
> I explain. I would like to create a generic action
> (e.g. action to send an
> email using the content fullfilled by a user in a
> form) which is not linked
> to a particular actionform (e.g. registration form,
> cancellation form,
> approval form). In this case, the action should
> retrieve from the
> Actionform object, the properties (e.g. first name,
> last name, ...) using
> introspection because those are not known inside the
> action. The properties
> are different from objectform to objectform.
> 
> 
> Met vriendelijke groeten - Cordialement - Best
> Regards,
> 
> Ir. Charles Moulliard
> eBusiness Solutions Architect
> 
> SkillTeam NV, AV. Roodebeek - Roodebeeklaan 89 -
> 1030 Brussel
> Tel    :  +32 (0)2 743 49 00
> Fax    : +32 (0)2 743 49 01
> GSM  : +32 0486 25 98 52
> eMail  :  chm@SkillTeam.com
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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