struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "SUHAS G. KULKARNI" <suha...@ctd.hcltech.com>
Subject RE: Index of an arrayList in a options tag
Date Fri, 24 Aug 2001 05:34:47 GMT
try 
      <html:select property="singleSelect" size="5">
        <html:options collection="arrayList" property="name"
labelProperty="value"/>
      </html:select>
	
Create the LabelValueOptions class having name(put numbers) and value("item
text") add them in the arrayList .

	

-----Original Message-----
From: Ganendran Kumaraswamy [mailto:Ganendran@eRunway.com]
Sent: Friday, August 24, 2001 10:58 AM
To: 'struts-user@jakarta.apache.org'
Subject: Index of an arrayList in a options tag


Hi All,

I am using an arraylist to hold some values and display them in a select box
as follows.

      <html:select property="singleSelect" size="5">
        <html:options property="selectList" labelProperty="selectList"/>
      </html:select>

I have created the arraylist in my action class and added some values to it.
Then I set it to the form (to the selectList variable). Of course I have the
getter and setter methods in my bean and it works fine. My question is, can
I display the index of the arraylist as the value property in my option html
tag ? How do I do it ? For e.g. I would ideally like the output to be like 

<option value="0">Some text </option>
<option value="1">Some other text</option>

Cheers,
Gane

Mime
View raw message