I'm working on my SCWCD using the head first book. I'm trying to send a request directly to a JSP. My test is working, but the naming convention of properties seems inconsistent.
Here is my HTML
This is my Direct.jsp
Everything works as expected with the breed property. The methods are getBreed and setBreed so the bean property is breed with a lowercase 'b'. Correct ?
But ID is different. It seems that because the second character is upper case, the convention is no longer to strip off get/set and replace the first character with its lowercase. The convention is just to strip off get and set.
Am I correct ?
My second question is can this property setting be done with anything other than String property types? If my set methods take integers, is there a way to have the conversion done in the jsp?
Thanks for your consideration.
Bear Bibeault wrote:Things can go easily awry when the bean conventions are violated.
When I have a property for an id (obviously a common need), I always use setId() and getId() so that I can use the normal convention of "id" as the property name.
I don't recommend following the example of "ID".
Yes, the convention for variable names says that (except constants) variables start lowercase and then follow the camel case principle.