aspose file tools*
The moose likes Struts and the fly likes Stuck with optionsCollection Tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Stuck with optionsCollection Tag" Watch "Stuck with optionsCollection Tag" New topic
Author

Stuck with optionsCollection Tag

Vinay Gangoli
Greenhorn

Joined: Jun 13, 2003
Posts: 22
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.


SCJP 1.4<br />" Somedays ur the dog...other days ur the water hydrant "
poornima balagopal
Ranch Hand

Joined: Dec 02, 2003
Posts: 83
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

Joined: Jun 13, 2003
Posts: 22
Thanks for your reply.
I tried it..I am still getting the same exception. What am i doing wrong ?
poornima balagopal
Ranch Hand

Joined: Dec 02, 2003
Posts: 83
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

Joined: Jun 13, 2003
Posts: 22
Thanks poornima....I got it...PHEW!!!.
chingh tangh
Greenhorn

Joined: Apr 06, 2004
Posts: 11
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stuck with optionsCollection Tag