Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

struts select and options

 
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jonathan,

I've never heard of an <html:optionsCollection> tag, and I don't see it in the documentation. I'd suggest using <html:options>. 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 ]
 
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you both for answering my question!
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've had positive experiences with optionsCollection and Junilu has good things to say about it in his blog.
 
reply
    Bookmark Topic Watch Topic
  • New Topic