What you are seeing is the correct behaviour. I think the piece of the
puzzle you are missing is that, in the part of the JavaBeans spec you are
looking at, it says:

"Thus when we extract a property or event name *from the middle of an
existing Java name*, we
normally convert the first character to lower case."

For example, when extracting the property name from a method named
'getLastName', the first character is converted to lower case, resulting in
the property name 'lastName'.

The thing that is a bit confusing is that the JavaBeans spec talks about how
to obtain the property name from a method (getter or setter) name, whereas
we (at least you and I, anyway!) tend to think of the process the other way
around, as in "what is the getter name for this property?".

Hope this helps.

--
Martin Cooper


----- Original Message -----
From: "Tim Colson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 06, 2001 12:12 PM
Subject: Bean Introspection and <bean:write> tag


> As per the bean: struts API docs, I've included an "Employee" type object
> into the request scope called "emp".
>
> emp can get/set the "mLastName" property using getLastName() and
> setLastName()
>
> However - when I try the following
>
> <bean:write name="emp" property="LastName"/>
>
> I'm told that there is no "getter" method
> javax.servlet.ServletException: No getter method for property LastName of
> bean
>
> If I make the property initial lower case, it works fine:
> <bean:write name="emp" property="lastName"/>
>
>
> The Bean Spec Section 8.8 says this about capitalization:
> So for example, "FooBah" becomes "fooBah"
> ---
> So for example, "LastName" becomes "lastName"
> I tried adding the accessor "getlastName()" to my Employee class - still
> fails.
>
> Property   -> get method    : result
> -------------------------------------
> "lastName" -> getLastName() : OK
> "LastName" -> getLastName() : Fails
> "LastName" -> getlastName() : Fails
> "LastName" -> get?????()
>
> I searched the archives and read more of the bean spec - but didn't pull
up
> anything useful on this. :-(
>
> Thanks,
> Tim
>
>


Reply via email to