• Post Reply Bookmark Topic Watch Topic
  • New Topic

trouble with first time bean. "no such property" exception  RSS feed

 
Bill Brasskey
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to using beans in jsp's, and I've written a java class that is basically nothing but private variables, with public getter and setter methods to access them. However, when I try to set the values, i get a "no such property" exception. Of course I've checked to make 100% certain the parameter names and the property names in the java class are identical, the class file is in the right place/package in the webinf/classes directory, etc. I'm using JRun4. Is there something I'm missing here? Can I not simply place the class file in the proper package in webinf/classes, point <jsp:useBean> to the right place to create the object, and be ready to go or do I have to jar the class file? As long as the property name and the parameter name are identical, i should be able to set the properties using <jsp:setProperty id="beanName" property="*">, right? Like I said, I'm new to this, so please forgive for the lame question. Any hints will be greatly appreciated.
[ September 02, 2004: Message edited by: Bill Brasskey ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that should work. What names are you giving to the form elements, and what are their corresponding mutators in your bean?
 
Bill Brasskey
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Form element name is (for example)"applicant_last_name", with the corresponding variable in the java class being identical.
[ September 02, 2004: Message edited by: Bill Brasskey ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Form element name is (for example)"applicant_last_name", with the corresponding variable in the java class being identical.


What you name the variable doesn't mean a hill of beans (pun absolutely intended). You need to familiarize yourself with the JavaBean property rules a bit.

If the name of your form element is "applicantLastName", your bean needs to have a mutator (setter) with the name setApplicantLastName. Note the casing; it's mandatory.

If you don't follow the JavaBean property naming rules, it just won't work.
 
Bill Brasskey
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ahhhhh...
indeed.
thanks, man.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!