tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Isaacs <>
Subject RE: DO NOT REPLY [Bug 46293] New: Bean property getter not found when using EL expression
Date Wed, 26 Nov 2008 16:54:46 GMT
It has been a long time, but I believe the bean property naming convention is that if the second
letter is capitalized, the first letter should be capitalized too, avoiding property names
like "uRL".  If you really want "xKey", you can provide a MyBeanBeanInfo class to go with
MyBean to specify what you want.  For more details, see the JavaBeans API.


-----Original Message-----
From: Karl R. San Gabriel []
Sent: Wednesday, November 26, 2008 10:13 AM
To: Tomcat Developers List
Subject: Re: DO NOT REPLY [Bug 46293] New: Bean property getter not found when using EL expression wrote:
>            Summary: Bean property getter not found when using EL expression
>            Product: Tomcat 6
>            Version: 6.0.18
>           Platform: PC
>         OS/Version: Windows Vista
>             Status: NEW
>           Severity: regression
>           Priority: P2
>          Component: Jasper
>         AssignedTo:
>         ReportedBy:
> The EL expression ${myBean.xKey} does not yield a call to myBean.getXKey().
> However, ${myBean.XKey} does.
Dear All,

I was investigating this bug last night (Philippine time) and found out
something interesting which left me bewildered.
I was trying to come up with a proposed fix. :-)

I have the ff files:


        package testpckg;
        public class MyBean {
            private String xKey = "xKey in the house";
            private String name = "name in the house";

            public String getXKey() { return xKey;}
            public String getName() { return name; }
            public void setXKey(String xKey) { this.xKey = xKey;}
            public void setName(String name) { = name;}

    b) index.jsp

       <jsp:useBean id="test" class="testpckg.MyBean"/>

In, BeanInfo.getPropertyDescriptors() is
giving the ff:

    pds[0].getName(): XKey
    pds[1].getName(): class
    pds[2].getName(): name

That BeanInfo.getPropertyDescriptors() call is in :

        protected final static class BeanProperties {
        private final Map<String, BeanProperty> properties;

        private final Class<?> type;

        public BeanProperties(Class<?> type) throws ELException {
            this.type = type;
   = new HashMap<String, BeanProperty>();
            try {
                BeanInfo info = Introspector.getBeanInfo(this.type);
                PropertyDescriptor[] pds = info.getPropertyDescriptors();
                for (int i = 0; i < pds.length; i++) {
          [i].getName(), new BeanProperty(
                            type, pds[i]));
            } catch (IntrospectionException ie) {
                throw new ELException(ie);

It looks like Java is taking XKey from getXKey().
I could make the code convert the first character of the property to
lowercase but I not sure about that.

My settings:
    Java 1.5


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message