struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Hill <andrew.david.h...@gridnode.com>
Subject Re: ??? property naming convention problem
Date Tue, 14 Dec 2004 15:13:37 GMT
Yes, it is rather confusing. I wasted *many* hours with this issue the 
first time it hit me!

Another poster also stated that putting the property name as "ECoupon" 
in the JSP would work - and thats because with a getter getECoupon() 
that IS the real property name (like your saying in the last line of 
your email).

Iirc the bean property capitalisation rules - which also cover multiple 
capital letters in a row - mean there is no equivalant getter for the 
property "eCoupon", instead its "ECoupon" that maps to the getter 
"getECoupon". So the fact here is that your _not_ naming your property 
"eCoupon" - your naming it "ECoupon"! :-)

(The internal varioable name might be eCoupon, but it could equally well 
be foo or bob, or anything - it doesnt matter for the determination of 
the property name and as far as code that works with JavaBeans is 
concerned that property is called "ECoupon" and not "eCoupon".





Daniel Perry wrote:

> This is confusing.  The bean spec / article is talking about going from a
> method name into a property name.  The problem here is the other way round.
> 
> Eg, decapitalise method->property will convert: getECoupon -> ECoupon
> But it doesnt mention property->method capitalise: eCoupon -> getECoupon /
> geteCoupon
> 
> I think the assumption has been made that if youre going to go from
> getECoupon ->ECoupon that you must go from ECoupon->getECoupon and therefore
> eCoupon->geteCoupon
> 
> However the spec doesnt say that this should be a reversible process, so why
> not eCoupon->getECoupon
> 
> Daniel.
> 
> 
>>-----Original Message-----
>>From: Andrew Hill [mailto:andrew.david.hill@gridnode.com]
>>Sent: 14 December 2004 14:01
>>To: Struts Users Mailing List
>>Subject: Re: ??? property naming convention problem
>>
>>
>>Sure is mate!. Its all in the javabean specs
>>
>>This post should enlighten you further:
>>
>>http://marc.theaimsgroup.com/?l=struts-user&m=98900256403524&w=2
>>
>>
>>And for another getter/setter 'gotcha' you can read this thread through
>>
>>http://marc.theaimsgroup.com/?l=struts-user&m=102696975022454&w=2
>>
>>hth
>>Andrew
>>
>>Vinod Easaw Varghese wrote:
>>
>>>Hi,
>>>
>>>    I have a textbox in a JSP whose property has been named as eCoupon.
>>>I have created the necessary ActionForm with the necessary setter and
>>>getter methods such as setECoupon and getECoupon.
>>>    When I run submit the form within the corresponding JSP I get the
>>>error message not able to find the corresponding getter method for
>>>property eCoupon
>>>    The moment I changed the property name to ecoupon and made the
>>>necessary adjustments within the ActionForm all began to work well.
>>>
>>>Is there a property naming convention to be followed in STRUTS
>>>
>>>
>>>With thanks and Regards
>>>
>>>Vinod Easaw Varghese
>>>
>>>
>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
> 
> 
> 


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


Mime
View raw message