I have mysterious happenings in my code. Here's the snippet from the bean:
public List<HelpContentsFrag> getCFrags()
{
return cFrags;
}
public void setCFrags(List<HelpContentsFrag> frags)
{
cFrags = frags;
}
Here's the snippet from my view code (tag file)
cFrags:[${topic.cFrags}]
where topic is an object of the bean type.
Here's the error:
javax.el.PropertyNotFoundException: Property 'cFrags' not found on type com.company.beans.BeanClass
One additional thing to consider. There is a subtle difference in the eclipse-generated setter. Apparently, it didn't like the name cFrags either. The field name is cFrags and with every other setter I get parameter with the same name as the field and it is set using the convention this.fieldName = fieldName
. You'll notice that eclipse did not stick with that on this setter.
FYI: this all works great when I change the getter to getContentsFrag()
and reference it .contentsFrag
.
I believe you want:
With a capital C. See JavaBeans Spec:
To quote the JavaBeans specification (last updated in 1997):
That describes how method names are converted to property names. What's not so clear is that the Introspector produces a single table that's used by property->method lookups as well.
You've already discovered one way to avoid the problem. Another is to create a
BeanInfo
class that contains the correct property->method mappings (theIntrospector
doc describes how to do this).