• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

javabean getter and setter

 
Ranch Hand
Posts: 42
Mac
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Sheriff
Posts: 3064
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
I guess I've been abducted by space aliens. So unprofessional. They tried to probe me with this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic