title: Validator with attributes for custom component
body: <p>I want to create validator for custom component where I want to pass few attributes. This is how code looks like (it's not original code but is implemented in the same way):</p>
  
  <p>Custom component (customComponent.xhtml)</p>
  
  <pre><code>&lt;h:body&gt;
      &lt;composite:interface componentType="compositeComponent"&gt;
          &lt;composite:attribute name="name" required="true" /&gt;
          &lt;composite:attribute name="value" required="true" /&gt;
          &lt;composite:attribute name="values" required="true" /&gt;
          &lt;composite:editableValueHolder name="validator" targets="#{cc.attrs.id}"/&gt;
      &lt;/composite:interface&gt;
      &lt;composite:implementation&gt;
          &lt;h:selectOneMenu value="#{cc.attrs.value}" id="#{cc.attrs.id}"&gt;
              &lt;f:selectItems value="#{cc.attrs.values}" var="item" itemValue="#{item.value}" itemLabel="#{item.label}" /&gt;
              &lt;composite:insertChildren/&gt;
          &lt;/h:selectOneMenu&gt;
      &lt;/composite:implementation&gt;
  &lt;/h:body&gt;
  </code></pre>
  
  <p>As you can see I want to pass validator to <code>h:selectOneMenu</code>. Component can be (to be more precisely 'should be' because it currently doesn't work) used in this way:</p>
  
  <pre><code>&lt;ns:customComponent name="myComp" value="#{controller.value}" values="#{controller.values}"&gt;
      &lt;f:validator validatorId="myValidator" for="validator"&gt;
          &lt;f:attribute name="param1" value="param1Value"/&gt;
          &lt;f:attribute name="param1" value="param1Value"/&gt;
      &lt;/validator&gt;
  &lt;/ns:customComponent&gt;
  </code></pre>
  
  <p>I tested this code and validator is called if i don't pass attributes into it. </p>
  
  <pre><code>&lt;ns:customComponent name="myComp" value="#{controller.value}" values="#{controller.values}"&gt;
      &lt;f:validator validatorId="myValidator" for="validator"/&gt;
  &lt;/ns:customComponent&gt;
  </code></pre>
  
  <p>I found that attributes can be passed in this way:</p>
  
  <pre><code>&lt;ns:customComponent name="myComp" value="#{controller.value}" values="#{controller.values}"&gt;
      &lt;f:validator validatorId="myValidator" for="validator"/&gt;
      &lt;f:attribute name="param1" value="param1Value"/&gt;
      &lt;f:attribute name="param1" value="param1Value"/&gt;
  &lt;/ns:customComponent&gt;
  </code></pre>
  
  <p>but (as far as I know) only validator will be injected to custom component (thats why <code>for="validator"</code> is set on validator) so I won't be able to get these attributes. How can I pass attributes to this validator?</p>
  
  <p>BTW. If it's possible I will want to pass parameters as nested elements because it looks more clear. This one:</p>
  
  <pre><code>&lt;f:selectOneMenu&gt;
      &lt;f:validator validatorId="myValidator"&gt;
          &lt;f:attribute name="param1" value="value1"/&gt;
      &lt;/f:validator&gt;
  &lt;/f:selectOneMenu&gt;
  </code></pre>
  
  <p>instead of this one:</p>
  
  <pre><code>&lt;f:selectOneMenu&gt;
      &lt;f:validator validatorId="myValidator"/&gt;
      &lt;f:attribute name="param1" value="value1"/&gt;
  &lt;/f:selectOneMenu&gt;
  </code></pre>