FYI:
Found this somewhere a while back:
===========================
A PropertyDescriptor indicates not only the property, but also the
property
accessor methods (setter and getter methods). As described above, when
analyzing a bean, the Introspector first checks to see if it can get
a list of
PropertyDescriptors from the BeanInfo. If that fails, the Introspector
analyzes
the bean class, building a list of methods that match the signatures
<i>Type</i> get<i>Property</i>() and <i>void</i>
set<i>Property</i>(<i>Type</i>
value). From this list of methods, the Introspector then creates its
own
PropertyDescriptor list.
===========================
And then this from the bean 1.01 spec:
8.8 Capitalization of inferred names.
========================
When we use design patterns to infer a property or event name, we need
to decide what rules
to follow for capitalizing the inferred name. If we extract the name
from the middle of a normal
mixedCase style Java name then the name will, by default, begin with
a capital letter.
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”
We provide a method Introspector.decapitalize which implements this
conversion rule.
========================================
Craig.
[EMAIL PROTECTED] wrote:
Yes, you described the scenario perfectly, and much better than I did :) This is how I understand the process as well. Using your same example, Struts will not allow that tag <html:text property="nTerminal"/> and subsequently will not process the expected method named getNTerminal(). Instead a runtime error will occur while processing the tag (this is all the information I get from the WebLogic Servlet container). For things to work, I have to rename the property as "nterminal" in the bean and update the tag as well to <html:text property="nterminal"/>. There is a problem with having a capital letter in the 2nd position of the property name.Bob-----Original Message-----Basically (and I might be wrong) when you subsequently try access the property, let's say with an <html:text property="nTerminal"/> tag, Struts will do a getNTerminal() on your ActionForm. The default is to take the property and do the following:
From: Craig Tataryn [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 14, 2001 10:28 AM
To: [EMAIL PROTECTED]
Subject: Re: ActionForm property naming conventions
1) append a "get" prefix to the property
2) change the first letter of the property to uppercase
3) call that method on the form bean.So for instance, it's prefixing your nTerminal property and mangaling it like so:
getNTerminal()
Like I said, I haven't looked at the code, but this is how I understand the process.
Craig.
[EMAIL PROTECTED] wrote:
My question is best asked with an example... Why is it that I am unable to--
create a property named "nTerminal" for my ActionForm/JSP? This problem
occurs when there is an uppercase letter in the 2nd position of the property
name. If I change the name to "nterminal" or "ntErminal" then things work
just fine. In other words- getNterminal() is recognized by Struts, but
getNTerminal() is invalid and results in a runtime error in the html tag. Is
this a limitation imposed by Javabean conventions or is this a Struts
specific issue? (If you think I am crazy, then perhaps this problem is
specific to WebLogic.)Thanks,
Bob
I've been trying to change the world for years, but they just won't give me the source code....
--
I've been trying to change the world for years, but they just won't
give me the source code....
begin:vcard n:Tataryn;Craig tel;home:952-884-6752 tel;work:952-842-5576 x-mozilla-html:TRUE url:http://www.computer-programmer.org org:Compuware;Professional Division adr:;;3600 West 80th St. Suite 400;Bloomington;MN;55431;United States of America version:2.1 email;internet:[EMAIL PROTECTED] title:Senior Staff Analyst fn:Craig Tataryn end:vcard