You jogged my memory and I have a solution from the Appendix of "Struts In
Action."  Version 1.1 and onward (possibly even in 1.0), struts
ActionMappings have had two attributes: "prefix" and "suffix." The are from
the ActionConfig class but carry over to the ActionMapping class used by the
Struts-Config.xml. Their use would be (you probably shouldn't mix them as in
this stupid example):

<action ....
        name="someForm"
        prefix="..."
        suffix="..."
        />
</action>

The JavaDocs from the ActionConfig class (ActionMapping extends it) are:

Prefix used to match request parameter names to form bean property names, if
any.
Suffix used to match request parameter names to form bean property names, if
any.

So how/why would you use it?  Do you plan on having a wizard where some
field names are the same on different pages?  That way page 1 variables
could be oneId, oneTextField, etc. then page two could be
twoId, twoUsername, twoPassword, and page3 could be threeId,
threeShippingAddr1, etc. all within the same ActionForm/Pojo?  If that is
the case I guess it could make wizards easier and avoid variable collision.

Regards,
David

-----Original Message-----
From: David Durham [mailto:[EMAIL PROTECTED]
Sent: Friday, September 01, 2006 4:42 PM
To: Struts Users Mailing List
Subject: Re: Mapping between a request parameter name and a Struts form
property name


Andrey Falaleev wrote:
> Hello everybody,
>
> I'd have the following question: Let's suppose I call a Struts
> action, which is bound to a particular form through struts-config.xml.
> As far as I know, the request is being analysed internally by Struts
> at the beginning, such that for each form property the corresponding
> request parameter is searched by name. E.g., if there is a property
> 'id' in a form, the reqest is analysed for an 'id' parameter. Am I
> right?
>
> The question is: may I specify a request parameter name for
> the particular form property manually? E.g., to tell Struts
> that for the form property 'id' I would like to use the request
> parameter 'objectId'?



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

Reply via email to