Craig,

In my case the link is on a column of an editable indexed properties table. And the 2 
parameters for each row would be specific to that row. So where/how would I get the 
parameters into a HashMap?

The JSP code is like this:

  <% int i=0; %>
  <logic:iterate id="rfq" name="submitQuotesForm" property="rfqListBean.rfqList">
  <tr>
    <td>
      <bean:write name="submitQuotesForm" property= '<%= "rfqListBean.rfqList[" + i 
+"].usingLocationCode" %>' />
    </td>

    <td>
      <html:link href="part.do" paramId="motorola_part" paramName="submitQuotesForm" 
paramProperty='<%= "rfqListBean.rfqList[" + i +"].motorolaPartNbr" %>' ><bean:write 
name="submitQuotesForm" property= '<%= "rfqListBean.rfqList[" + i +"].motorolaPartNbr" 
%>'  />
      </html:link>
    </td>

    <td>
      <html:text property='<%= "rfqListBean.rfqList[" + i +"].PriceObjective" %>' 
size="5" />
    </td>

    .... and so on......

  <tr>
</logic:iterate>

Thanks

-Nimmi
-----Original Message-----
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 14, 2001 12:46 PM
To: struts-user@jakarta. apache. org (E-mail)
Subject: Re: Having problems passing more than one parameter with
<html:link> 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

Reply via email to