| Author |
struts select and options
|
jonathan Greens
Ranch Hand
Joined: Apr 07, 2004
Posts: 139
|
|
hi, I am trying to use struts select and options tag. In the following code, cell is a bean that represents an array of Strings, <html:select property="<%=cellProperty.toString()%>" value="<%=valueToBeSelected%>"> <html ptionsCollection name="cell" property="" /> </html:select> i have a hard time figuring out what property for optionsCollection should be... the way it is now struts will say No getter method for property of bean cell thanks!
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
Jonathan, I've never heard of an <html ptionsCollection> tag, and I don't see it in the documentation. I'd suggest using <html ptions>. Just specify a name with no property attribute. In this case, struts will assume that each element in the collection is a String and will use it as the list of options. [ March 15, 2005: Message edited by: Merrill Higginson ]
|
Merrill
Consultant, Sima Solutions
|
 |
sreenath reddy
Ranch Hand
Joined: Sep 21, 2003
Posts: 415
|
|
Hi There is <html ptionsCollection> too .but this tag needs the label and value for each of the elment in ur collection. ie.each of iur element in the collection should have atleast one set and get methods ........or if u just have atsring array ,make that array of new LabelValueBean(String,String) (This LabelValueBean is given by struts) and that tag will work then else its better as he mentioned use <html ptions name="cell"/>
|
 |
jonathan Greens
Ranch Hand
Joined: Apr 07, 2004
Posts: 139
|
|
|
thank you both for answering my question!
|
 |
Marc Peabody
pie sneak
Sheriff
Joined: Feb 05, 2003
Posts: 4725
|
|
|
I've had positive experiences with optionsCollection and Junilu has good things to say about it in his blog.
|
A good workman is known by his tools.
|
 |
 |
|
|
subject: struts select and options
|
|
|