This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Struts and the fly likes Problem with html:select  - Cannot find bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with html:select  - Cannot find bean" Watch "Problem with html:select  - Cannot find bean" New topic
Author

Problem with html:select - Cannot find bean

R Laksh
Greenhorn

Joined: Aug 27, 2003
Posts: 25
When I try to put a select box with some option tags, I am getting "Cannot find bean under name CustomerNames" error. I have searched the forum and im not able to solve it.


<html:select name="CustForm" property="selCustName" multiple="true" size="10">
<html ptions collection="CustomerNames" property="custName" labelProperty="id"/>
</html:select>


I am having a customer form which has a arraylist CustomerNames. This arraylist has customer bean which has proeprties custName and id. The custForm also has a String[] selCustName.

Please let me know what am I doing wrong here.

Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
for this one, I'd recommend using the optionsCollection tag, rather than the options tag. Here's the link for the user documentation on this:

http://struts.apache.org/struts-doc-1.2.8/userGuide/struts-html.html#options

so, for your example, the tag would be:

<htmlptionsCollection property="CustomerNames" value="custName" label="id"/>


Merrill
Consultant, Sima Solutions
R Laksh
Greenhorn

Joined: Aug 27, 2003
Posts: 25
Thanks for the reply. I tried by using that. But still getting the same error. "Cannot find bean under name CustomerNames".
R Laksh
Greenhorn

Joined: Aug 27, 2003
Posts: 25
Thanks for the reply. I tried by using that. But still getting the same error. "Cannot find bean under name CustomerNames".
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
try specifying name="custForm" property="CustomerNames"
R Laksh
Greenhorn

Joined: Aug 27, 2003
Posts: 25
Thanks a lot I got it!! Without specifying form name itself it is coming..previously there was some uncommented code. So I got the same error again.

Thank you again!!
 
GeeCON Prague 2014
 
subject: Problem with html:select - Cannot find bean