webtier@glassfish.java.net

Converter oddity in composite component.

From: <webtier_at_javadesktop.org>
Date: Wed, 26 May 2010 16:10:07 PDT

Hello. I'm seeing some interesting behavior with regards to composite components.

case 1)
<h:inputText value="#{bean.value}" />
If I have an h:inputText in a page and the value of the inputText references a field of type Long and the field is not required and no value is entered, then the setter for that field value is called with a value of null.
I would expect this behavior.

case 2)
<h:inputText value="#{cc.attrs.value}" />
If I put that inputText into a composite component, and everything else is the same, then the setter for that value IS called and the value of 0 is passed to it.
I would not expect this behavior.

case 3)
<h:inputText value="#{cc.attrs.value}" required="false">
    <f:converter converterId="javax.faces.Long"/>
</h:inputText>
If I explicitly set the converter within the composite component, then I get the expected behavior of null value, as in case 1.

case 4)
<h:inputText value=#{bean[field]}" />
If I pass the bean and fieldName to the composite component separately then I also get the expected behavior as in case 1.

So, why doesn't JSF know to automatically apply the converter in case 2 as it does in all the other cases?

Thanks,
Joel
[Message sent by forum member 'jweight']

http://forums.java.net/jive/thread.jspa?messageID=471605