Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with html:select - Cannot find bean

 
R Laksh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"/>
 
R Laksh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. I tried by using that. But still getting the same error. "Cannot find bean under name CustomerNames".
 
R Laksh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try specifying name="custForm" property="CustomerNames"
 
R Laksh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic