<jsp:getProperty> strange behaviour
I have a bean class whit set/get methods and from a JSP page when I try to get a property with:
<jsp:getProperty name="p" property="firstName"></jsp:getProperty>
and the method in the bean is named as:getFirstName
orgetfirstName
the property is returned;<jsp:getProperty name="p" property="FirstName"></jsp:getProperty>
and the method in the bean is named as:getFirstName
orgetfirstName
the property is not return开发者_如何学Goed and I have this exception:org.apache.jasper.JasperException: PWC6054: Cannot find any information on property 'FirstName' in a bean
Why? I know that for bean rules when I write a property name the container try to find a getter or setter method that start with get or set and then continues with the property name indicated (no matter if it starts with the first letter capitalized???)
Thanks.
Java beans rely on naming conventions for introspection, see the spec here:
http://www.oracle.com/technetwork/java/javase/documentation/spec-136004.html
You'll be most interested in section 8.3 (page 55 in the PDF).
No you are worng,
when you create getter and setter methods method will be created as getXxxx() and setXxxx() if the attribute is private String xxxx;
So please follow the code convention while creating getter and setter methods. this will resolve the issue.
So ur property will be lowercase letter as first_name in ur bean class
精彩评论