webtier@glassfish.java.net

JSF 2.0.3 and composite attributes "required" validation

From: <webtier_at_javadesktop.org>
Date: Wed, 27 Jan 2010 09:06:36 PST

Hi!

Yesterday we tried switching from JSF 2.0.2 snapshot to 2.0.3.
We ran into several issues, here's the most unexpected one:

I have declaration <composite:attribute name="headerText" required="false" default="#{cc.attrs.header}" type="String" shortDescription="header text to use, defaults to header name"/>
       
then
   <h:outputText styleClass="tableHeader" value="#{cc.attrs.headerText}"/>
renders as
   /resources/components/adjustableColumnHeader.xhtml @21,172 default="#{cc.attrs.header}"

looks like something is broken with expression evaluation.
Unfortunately I don't have much time-resources to experiment now, but I'd like to raise the issue early.

Also in cases such as
<composite:attribute name="list" required="true" shortDescription="collection to iterate through"/>

if I use the component with a panelGroup guard

<panelGroup rendered="#{not empty MyBean.list}">
   <my:outputResults list="#{MyBean.list}"/>
</panelGroup>

I still get the exception if the list is null. Probably it's okay because the tree is build despite the values of rendered expression.
Probably, the only way out is to change code to return Collections.emptyList instead of null. But there are similiar cases where I pass either null or a single object.

If this is an expected behavior that's fine, just would be nice to be sure.

Of course, obvious meaning of "required" looked like "some expression should be set for it" not "the specified value shouldn't be null". But may be strict variant is okay.
[Message sent by forum member 'nzinoviev' (nikita.zinoviev_at_sun.com)]

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