I’ve read some articles about writing composite components in JSF 2 and even about defining nested composite components, but I haven’t found the example to defining a composite component that can accept an undefined number of sub-components.
I would like to be able to create a composite components that can be used in a similar manner to this:
<special:fieldGroup>
<special:field name="x" value="..."/>
<special:field name="y" value="..."/>
...
</special:fieldGroup>
Is there an example or explanation on how to achieve this using the new JSF 2 syntax?
Thanks!
You need to use
<composite:insertChildren>to specify the location where the children of<special:fieldGroup>are to be inserted.You can just write the
<special:field>composite component “the usual way”. Therein you can have access to the parent and its eventual attributes by#{cc.parent.attrs.xxx}.