• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Bean properties - case convention anomaly

Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello -
I'm running into a really odd problem on Tomcat 3.2.1. Here goes: I've got a bean. The bean has a bunch of properties. Some of the fields look like this:
protected String aFieldName;
protected String bFieldName;
protected String cFieldName;
The corresponding accessor methods look like this:
public void setAFieldName(String v)
this.aFieldName = v;
public String getAFieldName()
return this.aFieldName;
Pretty straightforward stuff, it would seem. However, when using the standard jsp:setProperty and jsp:getProperty tags for the bean's properties, it appears the the JSP engine's introspection "breaks down" - it can't seem to locate the appropriate accessor method (throws "no get method for property 'aFieldName' found in bean ....". I get essentially the same result using Jakarta Struts tag extensions to manipulate the bean. Interestingly enough, I can access the method's directly using scriptlet code ("<% String foo = myBean.getAFieldName(); %>" ).
Now here's where it gets really bizare. Change the field names: instead of having a lower-case first position character, followed by an upper-case second position character, add in another lower-case character. So:
protected String aaFieldName;
And modify the accessor methods accordingly:
public void setAaFieldName(String v)
this.aaFieldName = v;
public String getAaFieldName()
return this.aaFieldName;
Now it works. Can anyone else reproduce this phenomenon - either on Tomcat or another JSP engine? Am I missing something? Any ideas would be much appreciated - while I'd like to simply rename the fields and put the whole issue to rest, the bean properties are being defined by a client's design documents. Thanks,
*** update ***
for anyone who's interested, it looks like this is a documented "bug" in tomcat 3.2.1: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=322
[This message has been edited by chris leonardi (edited March 16, 2001).]
Good heavens! What have you done! Here, try to fix it with this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic