Reading the specification clarified how things work, thank you. It's much nicer to know the reason why things happen than just what immediate fix would solve the problem. It seems that if bean.getEMail() is a given, JSP page has to have

<html:text property="EMail"/>

in order to work.

Actually, I do not think getEMail() method breaks any conventions. The reason property="eMail" does not work is because "to support the occasional use of all upper-case names, property name is not modified if first two characters are upper case". It seems to me that there is a fix for properties that break the naming convention (all upper case), but that fix breaks some cases that actually follow the naming convention ("eMail"). At least I did not see a rule that forbids a property name having the first "word" being only one character (is there one? I did not read much else besides chapters 8.3 and 8.8...).

Don't worry, I'm not going to use bean.getEMail() :)

From: Craig McClanahan <[EMAIL PROTECTED]>
Reply-To: Craig McClanahan <[EMAIL PROTECTED]>
To: Struts Users Mailing List <[EMAIL PROTECTED]>
Subject: Re: Struts & bean property capitalization - minor problem
Date: Thu, 2 Sep 2004 20:48:39 -0700

On Thu, 02 Sep 2004 14:07:37 +0000, Janne Mattila
<[EMAIL PROTECTED]> wrote:
> -formBean method getEeMail() and <html:text size="30" maxlength="120"
> property="eeMail"/> => works
> -formBean method getEmail() and <html:text size="30" maxlength="120"
> property="email"/> =>works
> - formBean method getEMail() and <html:text size="30" maxlength="120"
> property="eMail"/> =>
>
> => org.apache.jasper.JasperException: No getter method for property eMail of
> bean org.apache.struts.taglib.html.BEAN
>
> I don't know what method struts tries to find. Eclipse creates getter as
> getEMail() when I name a property "eMail". I think getEMail() is just fine
> getter for variable "eMail". (of course, one could argue whether variable
> name should be "email" instead, but lets not go there....)
>
> I am using 1.1, would a later release solve this?
>


Using a later release won't change anything, because the
commons-beanutils code that Struts uses under the covers requires you
to either follow the property naming conventions in the JavaBeans spec
(http://java.sun.com/products/javabeans/docs/spec.html), or provide
BeanInfo classes to tell the server what your property getter and
setter methods really are.  Property names like "eMail" break the
conventions, and are thus not recognized.  See the spec for more
details on all of this.

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to