Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stuck with optionsCollection Tag

 
Vinay Gangoli
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all....I am trying to display a collection using the tag shown below. I keep getting..
"Cannot find bean under name org.apache.struts.taglib.html.BEAN"
I have a collection attribute in the form which has bean objects in it.
Can anyone pls guide me as to what i am doing wrong.
<html:select property="attributeInForm">
<html ptionsCollection property="collectionInForm"
label="collection's Bean's Attribute"
value="collection's Bean's Attribute" />
</html:select>
Thanks.
 
poornima balagopal
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This is the way i am doing
<bean efine name="borrowerType" id="borrowerTypeList" scope="request"/>
<html:select property="borrowerType" onchange="JavaScript:getBorrowerCodes()" tabindex="1">
<html ptions collection="borrowerTypeList" labelProperty="borrowerType"
property="borrowerType"/>
</html:select>
I have a list of data i set to request from the action class i am loading the jsp page as
request.setAttribute("borrowerType",borrowerTypeList);
First i am defining an object for the collection using the bean efine . There whatever be the id we are giving it should match with the collection attribute of option .
Try like this
Hope this will help you
 
Vinay Gangoli
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.
I tried it..I am still getting the same exception. What am i doing wrong ?
 
poornima balagopal
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vinay,
<bean efine name="borrowerType" id="borrowerTypeList" scope="request"/>
<html:select property="borrowerType" onchange="JavaScript:getBorrowerCodes()" tabindex="1">
<html ptions collection="borrowerTypeList" labelProperty="borrowerType"
property="borrowerType"/>
</html:select>
I will explain how i am setting this.
Hope this will help you
Here in the bean define tag whatever i am giving as the ID it should match with the collection attribute of the html option tag. In the html: select the property attribute should match with the variable you have for that field in your formBean. And also the labelProperty and id of the options tag.
And please check the your code .(I afraid if your code is as you posted along with your question definitely it wont work )
Hope this time it will work
 
Vinay Gangoli
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks poornima....I got it...PHEW!!!.
 
chingh tangh
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to directly map form property as mentioned in above ex
<html:select property="attributeInForm">
<html ptionsCollection property="collectionInForm"
label="collection's Bean's Attribute"
value="collection's Bean's Attribute" />
</html:select>
tried setting this property in action, but not being displayed in the jsp...
Any more changes needed?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic