Having problems passing more than one parameter with html:link tag

2001-06-14 Thread Shamdasani Nimmi-ANS004

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


What am I doing wrong?

-Nimmi




Re: Having problems passing more than one parameter with html:link tag

2001-06-14 Thread Craig R. McClanahan



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





Re: Having problems passing more than one parameter with html:link tag

2001-06-14 Thread Ted Husted

I think you would need to use a map here.

 http://jakarta.apache.org/struts/struts-html.html#link 

Normally, the hyperlink you specify with one of the attributes
described in the previous
paragraph will be left unchanged (other than URL rewriting if
necessary). However, there
are two ways you can append one or more dynamically defined query
parameters to the
hyperlink -- specify a single parameter with the paramId attribute (and
its associated
attributes to select the value), or specify the name (and optional
property) attributes to
select a java.util.Map bean that contains one or more parameter ids and
corresponding values.

Shamdasani Nimmi-ANS004 wrote:
 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.



RE: Having problems passing more than one parameter with html:link tag

2001-06-14 Thread Shamdasani Nimmi-ANS004

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




RE: Having problems passing more than one parameter with html:link tag

2001-06-14 Thread Craig R. McClanahan



On Thu, 14 Jun 2001, Shamdasani Nimmi-ANS004 wrote:

 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?
 

Well, you've got them already don't you?  The keys are the two things you
are trying to pass for paramId and the values are the corresponding things
you are trying to look up with paramName and paramProperty.

In your page, it looks like you're using runtime expressions to try to get
the values dynamically.  To do it in the page, you'd need to use
scriptlets.  However, I would tend to have created an appropriate HashMaps
in the Action that forwarded to this page, so all I'd have to do is
reference it -- perhaps even create an array of HashMaps (one per row) so
that it corresponds to your data lookups.

Craig