• Post Reply Bookmark Topic Watch Topic
  • New Topic

javabean getter and setter  RSS feed

 
Fred Close
Ranch Hand
Posts: 42
Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I was having trouble with a struts page using a javabean Tartanpion containing the following property and getter and setter

the jsp page was throwing an exception :
javax.servlet.jsp.JspException: No getter method for property pRoperty of bean tartanpion
with the following getter and setter it works ok


I thought that the rule to write a getter and a setter method was :
get + name of the property (with the first letter of the property in capital)
set + name of the property (with the first letter of the property in capital)
so what's the rule to write getter/setter ?
btw : the code generation of IDEA and JBuilder does not give the same result :
for the property tOto
IDEA : gettOto()
JBuilder : getTOto()
who is right ?
 
Greg Charles
Sheriff
Posts: 3015
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generally speaking, you're right about the rule. However, I think you are confusing Struts by capitalizing the second letter. I don't know exactly why that confuses it though, since you could have a property called "fileName", for example, and not have a problem with that. One nice thing about Struts being open source, is you could download the source code and see exactly what's going on ... if you're really motivated.
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

However, I think you are confusing Struts by capitalizing the second letter. I don't know exactly why that confuses it though, since you could have a property called "fileName", for example, and not have a problem with that.

That was my first reaction too, but as Greg pointed out it should work. You could try changing pRoperty to paRoperty (or pbRoperty or whatever) and of course change the getters and setters to reflect that. If that works, then our hunch is right.
Michael Morris
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!