struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karr, David" <david.k...@attws.com>
Subject RE: What is Struts form field naming constraints
Date Wed, 23 Oct 2002 20:29:15 GMT
(If you care, this is apparently a problem with our local mail system,
there's nothing wrong with the Struts list.)

> -----Original Message-----
> From: Karr, David [mailto:david.karr@attws.com]
> Sent: Wednesday, October 23, 2002 12:08 PM
> To: 'Struts Users Mailing List'
> Subject: RE: What is Struts form field naming constraints
> 
> 
> (What the heck?  I sent this last reply SIX days ago, and I 
> just got it back
> on the list this morning.)
> 
> > -----Original Message-----
> > From: Karr, David [mailto:david.karr@attws.com]
> > Sent: Thursday, October 17, 2002 1:51 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: What is Struts form field naming constraints
> > 
> > 
> > > -----Original Message-----
> > > From: Craig R. McClanahan [mailto:craigmcc@apache.org]
> > > Sent: Thursday, October 17, 2002 1:34 PM
> > > To: Struts Users Mailing List
> > > Subject: Re: What is Struts form field naming constraints
> > > 
> > > On Thu, 17 Oct 2002, Norman Klein wrote:
> > > 
> > > > Date: Thu, 17 Oct 2002 13:12:41 -0700
> > > > From: Norman Klein <norman.klein@first-franklin.com>
> > > > Reply-To: Struts Users Mailing List 
> > <struts-user@jakarta.apache.org>
> > > > To: "'struts-user@jakarta.apache.org'" 
> > > <struts-user@jakarta.apache.org>
> > > > Subject: What is Struts form field naming constraints
> > > >
> > > > Struts appears to have some pretty rigid naming constraints 
> > > concerning for
> > > > its form field names. We are building a large form with 
> > > hundreds of form
> > > > variables (textboxes, selects , checkboxes). Many of these 
> > > sections repeat
> > > > so it is convenient to have a numeric suffix based on the 
> > index (ie
> > > > B2_Name). But then if this naming convention is used, 
> > > Struts can't seem to
> > > > find the corresponding getter and setter methods for it. To 
> > > overcome this
> > > > problem, we have had to use the following convention: BI2_Name.
> > 
> > > Form bean property names are constrained to meet the 
> > requirements for
> > > JavaBean property names in the JavaBeans Specification.  You 
> > > can find a
> > > download link starting at:
> > > 
> > >   http://java.sun.com/products/javabeans/
> > > 
> > > Note that the required characters is only part of the issue 
> > > -- you must
> > > also pay attention to the capitalization conventions that 
> > Java uses to
> > > convert property names into the names of the corresponding 
> > getter and
> > > setter methods.
> > 
> > In particular, I believe that if you have a method 
> > "getB2_Name()", it would
> > expect a property named "b2_Name".  When you changed to 
> > "BI2_Name", that
> > translates to "getBI2_name()" only because your property 
> > begins with TWO
> > capital letters.
> > 
> > In general, you're probably better off naming your 
> properties with an
> > initial lowercase letter.
> > 
> > It's also handy to read the source code for 
> > "java.beans.Introspector" in the
> > JDK, the class that implements this name mapping.
> > 
> > --
> > To unsubscribe, e-mail:   
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>

--
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