struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dante Briones <da...@electronicingenuity.com>
Subject Re: Problem with property in ActionForm
Date Mon, 22 Apr 2002 17:15:46 GMT
This is a feature of the JavaBeans property naming standards that allows 
you to have an all-caps property name.  To quote from the JavaBeans 
specification:
--
Java programmers are accustomed to having normal identifiers start with 
lower case letters.
Vigorous reviewer input has convinced us that we should follow this same 
conventional rule
for property and event names.

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. However to support the 
occasional use of all
upper-case names, we check if the first two characters of the name are both 
upper case and if
so leave it alone. So for example,

"FooBah" becomes "fooBah"
"Z" becomes "z"
"URL" becomes "URL"
--

So you would have to refer to the property on the jsp as "ACompanyId" in 
order to use the property as coded below.  Or you could rename the property 
something like "AdminCompanyId".

HTH,

db


At 04:54 PM 22/4/2002 +0200, you wrote:

>Hi all,
>
>I seem to have found a strange bug in Struts (or I need more coffee).
>
>I have an ActionForm with a property "aCompanyId" (the 'a' stands for
>admin), and thus have the following members:
>public Integer aCompanyId;
>public Integer getACompanyId();
>public void setACompanyId( Integer someId );
>
>But, when I try to reference this form in a .jsp using
>, I get the following error: javax.servlet.ServletException: No getter 
>method for property aCompanyId of bean org.apache.struts.taglib.html.BEAN 
>The strange part is that if I change the name of the property and the form 
>methods to "aaCompanyId" and "getAaCompanyId()" etc it *does* work. What's 
>wrong here? Greetings, Arjan Lamers 
>--------------------------------------------- Notice: The only person 
>getting his work done by Friday was Robinson Crusoe. -- To unsubscribe, 
>e-mail: For additional commands, e-mail:


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message