title: JSF 2 composites and binding for validation
body: <p>I have a problem with a JSF composite which validates internal input fields.
  Following code snippet works as long as only one composite is included.</p>
  
    <pre class="lang-html prettyprint-override"><code>&lt;div id="#{cc.clientId}" &gt;
    &lt;h:panelGroup styleClass="#{not firstname.valid ? 'fmError' : ''}"&gt;
      &lt;div class="col220"&gt;
          &lt;h:outputLabel for="firstname" value="Vorname(n):" /&gt;
      &lt;/div&gt;
      &lt;div class="col220"&gt;
          &lt;h:inputText id="firstname" styleClass="fmTxt " 
              value="#{cc.attrs.person.firstname}" binding="#{firstname}"&gt;
              &lt;f:validateRequired /&gt;
          &lt;/h:inputText&gt;
  
      &lt;/div&gt;
    &lt;/h:panelGroup&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>As you can see I use the cc.clientId to wrap the composite and having unique IDs for the components inside the composite. So it is possible to include more than one composites on a single page.</p>
  
  <p>The problems starts with the validation and the need to bind the inputText component. I need this to ask the validation outcome in the panelGroup for highlighting not only the inputField but also the label.</p>
  
  <p>This code is working perfectly when using only one composite on a page. When using a second one, the inputField 'firstname' is not shown anymore. I guess it has to do with the binding and its hardcoded '#{firstname}'.</p>
  
  <p>Now the question: How can I create a unique identifier for the binding attribute?</p>
  
  <p>I'm thankful for any hint. Thanks!</p>