File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Bean properties - case convention anomaly Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Bean properties - case convention anomaly" Watch "Bean properties - case convention anomaly" New topic
Author

Bean properties - case convention anomaly

chris leonardi
Greenhorn

Joined: Feb 25, 2001
Posts: 3
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,
Chris
*** 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).]
 
 
subject: Bean properties - case convention anomaly
 
Threads others viewed
returning XML using XML-RPC
IIS +Tomcat for some reason the query strings are stripped???
Request.getRemoteUser() returns null in Tomcat 4.1.24.
Tomcat 4.0.2 unpacking wars
Why Does This Produce Empty Jar Files?
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture