title: Find one or more components within f:facet - does it work as designed?
body: <p>I have on my page a custom component with a Facet inside</p>
  
  <pre><code>&lt;jtcomp:blockUI ...&gt;
     &lt;f:facet name="events"&gt;
        &lt;f:param name="filtering" value="true"/&gt;
        &lt;f:param name="sorting" value="true"/&gt;
        &lt;f:param name="paging" value="true"/&gt;
     &lt;/f:facet&gt;
     ...
  &lt;/jtcomp:blockUI&gt;
  </code></pre>
  
  <p>In the renderer class I intend to gather all UIParameter (f:param). At first I get the facet as follows</p>
  
  <pre><code>UIComponent facet = blockUI.getFacet("events");
  </code></pre>
  
  <p>Well. Now I thought I can call facet.getChildren() and iterate then over all childs. But I have debugged and figured out I can only do it if f:facet contains more than one f:param components. If it only has one f:param like this</p>
  
  <pre><code>&lt;jtcomp:blockUI ...&gt;
     &lt;f:facet name="events"&gt;
        &lt;f:param name="filtering" value="true"/&gt;
     &lt;/f:facet&gt;
     ...
  &lt;/jtcomp:blockUI&gt;
  </code></pre>
  
  <p>the call above delivers already this component. I mean, facet is an UIParameter. Therefore, the entire logic looks like</p>
  
  <pre><code>// collect all f:param
  List&lt;UIParameter&gt; uiParams = new ArrayList&lt;UIParameter&gt;();
  if (facet instanceof UIParameter) {
    // f:facet has one child and that's f:param
    uiParams.add((UIParameter) facet);
  } else if (facet != null &amp;&amp; facet.getChildren() != null) {
    // f:facet has no or more than one child
    for (UIComponent kid : facet.getChildren()) {
       if (kid instanceof UIParameter) {
          uiParams.add((UIParameter) kid);
       }
    }
  }
  </code></pre>
  
  <p>Is it an expected JSF behavior or just a Mojarra bug (I'm using Mojarra 2.1.0-b02)? I know, that before JSF2 only one component was allowed to be inside of f:facet. Maybe they still check it and don't instantiate FacetsMap if only one child component is available. Instead of FacetsMap containing all child components there is then the child component self bound as a facet to the parent component.</p>
  
  <p>What do you think? I could nothing find in the JSF specification. Thanks in advance for your replies!</p>