File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes struts select and options Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts select and options" Watch "struts select and options" New topic
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 <htmlptionsCollection> tag, and I don't see it in the documentation. I'd suggest using <htmlptions>. 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: 4727

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: struts select and options