You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Craig R. McClanahan" <cr...@apache.org> on 2001/06/14 19:45:58 UTC
Re: Having problems passing more than one parameter with
tag
On Thu, 14 Jun 2001, Shamdasani Nimmi-ANS004 wrote:
> Hi,
>
> I am trying to pass 2 parameters with html:link. Since it is not legal to use the same attribute name more than once in the same tag, I created another reference 'tempId' to my 'submitQuotesForm' bean using <bean:define> tag but I am only getting the last param 'supplier_seq' added to my link.
>
> Here's my JSP code:
>
> <bean:define id="tempId" name="submitQuotesForm" type="com.motorola.mms.msqc.beans.SubmitQuotesForm" />
> <html:link href="part.do"
> paramId="motorola_part" paramName="submitQuotesForm" paramProperty="partNbr"
> paramId="supplier_seq" paramName="tempId" paramProperty="supplierSeq" >
> <bean:write name="submitQuotesForm" property= "partNbr" />
> </html:link>
>
Using "paramId" and "paramName" only works if you want to add a *single*
parameter to the link. XML does not allow you to specify the same
attributes twice in a single tag.
If you want to add multiple parameters, use the following approach:
* Create a Map (such as a HashMap or TreeMap) where the keys
are the parameter names and the values are either String (for
a single parameter value) or array of String (for multiple
parameter value).
* Use <bean:define> or some other technique to introduce this
object into some appropriate scope. I tend to do this in
my Actions (or business logic that they delegate to).
* Code your link tag like this:
<bean:define id="parametersMap" .../>
<html:link href="part.do" name="parametersMap">
...
</html:link>
>
> What am I doing wrong?
>
> -Nimmi
>
>
Craig