title: JSF refuses to process a deeply nested composite component. No, really: "JSF1098: [...] This is a waste of processor time [...]"
body: <p>The premise is quite straightforward: I have a page layout that relies on nested composite components (CC) to do the rendering, i.e. one JSF page references a CC, which itself references another CC, which contains a call to a third CC. - Source below.</p>
  
  <p>Now, when that third CC wants to execute a bean method using ajax which would result in a fully self-contained partial update... nothing happens.*</p>
  
  <p><a href="https://i.stack.imgur.com/E3Fgt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/E3Fgt.png" alt="Nested JSF CCs: Black: CC that executes a call from attributes. Red: Outer CC that passes its children to blue. Blue: Intermediate that inserts children for red."></a></p>
  
  <p>I have searched SO and other places extensively, and have investigated all points of BalusC's insightful post <a href="https://stackoverflow.com/a/2120183/2446808">here</a>, but I've come up empty. Trace logging finally turned up the following message during the apply, validate and render stages, resulting in an "empty" response: <strong>FINER [javax.enterprise.resource.webcontainer.jsf.context] ... JSF1098: The following clientIds were not visited after a partial traversal: fooForm:j_idt14:j_idt15:j_idt18 .  This is a waste of processor time and could be due to an error in the VDL page.</strong></p>
  
  <p>*) This only happens under very particular circumstances (which, though, are the exact definition of my use case):</p>
  
  <ul>
  <li>Deeply nested CCs, at least two parent levels.</li>
  <li>The nesting must be implicit, i.e. different CCs calling another, not just nested tags directly inside the calling page.</li>
  <li>"Higher" CCs pass down children which are inserted in the "lower" CC using <code>&lt;cc:insertChildren /&gt;</code>.</li>
  <li>The CC that performs the ajax call and partial update contains <code>actions</code> dynamically created from the CC's attributes or clientId. (But not even necessarily in the same call, just inside the same component.)</li>
  </ul>
  
  <p>All have to be met at the same time: If I use the innermost CC higher up in the hierarchy (or the nesting including the call to the final CC is all inside the calling page), everything works. If I use facets, no problem. If I remove or hard-code the <code>action</code> parameter, all good.</p>
  
  <p>(Currently testing on EE6, EAP 6.4, but is the same in an EE7 project running on EAP 7.0)</p>
  
  <p>Calling page:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:my="http://java.sun.com/jsf/composite/components/nestedcomponents"&gt;
  
      &lt;h:head&gt;
          &lt;title&gt;Nested composite component test&lt;/title&gt;
      &lt;/h:head&gt;
  
      &lt;h:body&gt;
          &lt;h:form id="fooForm"&gt;           
  
          &lt;h2&gt;Works&lt;/h2&gt;
          &lt;my:randomString saveBean="#{util}" saveAction="doSomething" /&gt;
  
  
          &lt;h2&gt;Doesn't&lt;/h2&gt;
          &lt;my:containerInsertingAnotherUsingInsertChildren&gt;
              &lt;my:randomString saveBean="#{util}" saveAction="doSomething" /&gt;
          &lt;/my:containerInsertingAnotherUsingInsertChildren&gt;
  
          &lt;/h:form&gt;
      &lt;/h:body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Innermost CC: (<code>&lt;my:randomString&gt;</code>, black frame; the <code>#{util}</code> is a request-scoped bean with one-liner dummy methods)</p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:cc="http://java.sun.com/jsf/composite"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"&gt;
  
  &lt;cc:interface&gt;
      &lt;cc:attribute name="someValue" /&gt;
      &lt;!--cc:attribute name="someAction" method-signature="void action()" /--&gt;
      &lt;!--cc:attribute name="someAction" targets="btn" targetAttributeName="action" /--&gt;
      &lt;cc:attribute name="saveBean" /&gt;
      &lt;cc:attribute name="saveAction" /&gt;
  &lt;/cc:interface&gt;
  
  &lt;cc:implementation&gt;
      &lt;h:panelGroup layout="block" id="box" style="border: 1px solid black; margin: 3px; padding: 3px;"&gt;
          &lt;h:outputText value="#{cc.attrs.id} / #{cc.clientId} / #{util.getRandomString()} " /&gt;
  
          &lt;h:commandLink id="btn" value="save!" action="#{cc.attrs.saveBean[cc.attrs.saveAction]}" &gt;
              &lt;f:ajax render="box" immediate="true" /&gt;
          &lt;/h:commandLink&gt;
      &lt;/h:panelGroup&gt;
  &lt;/cc:implementation&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>Outer, wrapping CC: (<code>&lt;my:containerInsertingAnotherUsingInsertChildren&gt;</code>, red frame)</p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:cc="http://java.sun.com/jsf/composite"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:my="http://java.sun.com/jsf/composite/components/nestedcomponents"&gt;
  
  &lt;cc:interface&gt;
  &lt;/cc:interface&gt;
  
  &lt;cc:implementation&gt;
      &lt;h:panelGroup layout="block" style="border: 1px solid red; margin: 3px; padding: 3px;"&gt;
          &lt;my:containerUsingInsertChildren&gt;
              &lt;cc:insertChildren /&gt;
          &lt;/my:containerUsingInsertChildren&gt;
      &lt;/h:panelGroup&gt;
  &lt;/cc:implementation&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>Intermediate CC: (<code>&lt;my:containerUsingInsertChildren&gt;</code>, blue frame)</p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:cc="http://java.sun.com/jsf/composite"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:p="http://primefaces.org/ui"&gt;
  
  &lt;cc:interface&gt;
  &lt;/cc:interface&gt;
  
  &lt;cc:implementation&gt;
      &lt;h:panelGroup layout="block" style="border: 1px solid blue; margin: 3px; padding: 3px;"&gt;
          &lt;cc:insertChildren /&gt;
      &lt;/h:panelGroup&gt;
  &lt;/cc:implementation&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>As I wrote, hard-coded calls work as expected and update the little attached box. As soon as the bean method involves parameters (attributes) of the CC, and the CC sits deep enough in the hierarchy, they just get skipped.</p>
  
  <p>I'm at a loss, and solutions or workarounds are most welcome.</p>