Reputation: 5046
I've a form with struts tags as below.
<html:form styleId='catform' action='/cat/submit.html' method='post'>
<html:select property='catName' styleId='catName'>
<html:options collection='catList' property='category'>
</html:select>
</html:form>
In my action I'm setting catList as below
List <Category> catList = getCategoryList();
request.setAttribute("catList", catList);
here Category is a class with catName and catId as variables.
I'm getting an error which says no getter for the property category found. What am I missing?
Upvotes: 1
Views: 6020
Reputation: 8293
You need to put either a "collection", which is done between java tags like this :
collection="<%= myCollection %>"
or to use the "name" and "property" attributes like this :
name="mybean" property="beanPropertyWhichContainsTheCollection"
Don't use both "property" and "collection" attributes.
Upvotes: 1
Reputation: 23664
You need to put
<html:options collection='catList' property='catId' labelProperty='catName'>
struts is trying to get the category
property of the Category
instance
Upvotes: 2