I just dont get it:
If I want my composite component to insert children, I use <composite:insertChildren/>
but #{cc.childCount}
always returns 0
in that case. On the other hand, If I do not use <composite:insertChildren/>
I always get correct childCount
without children being rendered. Why is that happening?
All I want to do in my component is to render some "default" panel if there are no children and do not render it in other case - behavior similar to <ui:insert name="param_name">default value</ui:insert>
. So I need both insertChildren and childCount which do not seem to work together.
Here is the code:
<my:test>
<h:outputText value="child1" rendered="#{some.trueValue}"/>
<h:outputText value="child2" rendered="#{some.trueValue}"/>
<my:test>
If I use implementation below, I get 2
rendered as expected
<composite:implementation>
<h:outputText value="#{cc.childCount}"/>
</composite:implementation>
When insertChildren
is used I get both children rendered and 0
at the end:
<composite:implementation>
<composite:insertChildren/>
<h:outputText value="#{cc.childCount}"/>
</composite:implementation>
Whereas my goal is:
<composite:implementation>
<composite:insertChildren/>
<h:panelGroup rendered="#{cc.childCount == 0}">
some default data
</h:panelGroup>
</composite:implementation>
Any ideas/workarounds?
getFamily()
is unnecessary as that's already implemented inUINamingContainer
. Only when you implementNamingContainer
interface, or anotherUIComponent
subclass, you indeed have to specify yourself. – Shrunk