title: JSF2 composite components: are #{cc.childCount} and <composite:insertChildren/> mutually exclusive?
body: <p>I just dont get it: 
  If I want my composite component to insert children, I <strong>use</strong> <code>&lt;composite:insertChildren/&gt;</code> but <code>#{cc.childCount}</code> always returns <code>0</code> in that case. On the other hand, If I <strong>do not use</strong> <code>&lt;composite:insertChildren/&gt;</code> I always get correct <code>childCount</code> without children being rendered. Why is that happening?</p>
  
  <p>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 <code>&lt;ui:insert name="param_name"&gt;default value&lt;/ui:insert&gt;</code>. So I need both insertChildren and childCount which do not seem to work together. </p>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;my:test&gt;
    &lt;h:outputText value="child1" rendered="#{some.trueValue}"/&gt;
    &lt;h:outputText value="child2" rendered="#{some.trueValue}"/&gt;
  &lt;my:test&gt;
  </code></pre>
  
  <p>If I use implementation below, I get <code>2</code> rendered as expected</p>
  
  <pre><code>&lt;composite:implementation&gt;
    &lt;h:outputText value="#{cc.childCount}"/&gt; 
  &lt;/composite:implementation&gt;
  </code></pre>
  
  <p>When <code>insertChildren</code> is used I get both children rendered and <code>0</code> at the end:</p>
  
  <pre><code>&lt;composite:implementation&gt;
    &lt;composite:insertChildren/&gt;
    &lt;h:outputText value="#{cc.childCount}"/&gt; 
  &lt;/composite:implementation&gt;
  </code></pre>
  
  <p>Whereas my goal is:</p>
  
  <pre><code>&lt;composite:implementation&gt;
    &lt;composite:insertChildren/&gt;
    &lt;h:panelGroup rendered="#{cc.childCount == 0}"&gt;
      some default data
    &lt;/h:panelGroup&gt; 
  &lt;/composite:implementation&gt;
  </code></pre>
  
  <p>Any ideas/workarounds?</p>