I'm writing a composite component that contains an <h:selectManyMenu> and I'd like to allow clients of this component to supply validators and converters by placing <f:validator> and <f:converter> tags as children of my composite component's tag. In my composite's interface section I have
<composite:editableValueHolder name="select-input" targets="select-many" />
and in the implementation section:
<h:selectManyMenu id="select-many" styleClass="hidden select-input" value="#{cc.attrs['value']}" binding="#{cc.inputComponent}">
<composite:insertChildren />
</h:selectManyMenu>
and finally the usage:
<cwi:selectManyMenu id="select-many-menu" value="#{selectManyBean.selectedItems}">
<f:converter converterId="converter.testItem" for="select-many" />
<f:validator validatorId="validator.testItem" for="select-input" />
<f:selectItems value="#{selectManyBean.possibleItems}" var="item" itemValue="#{item}" itemLabel="#{item.description}" />
</cwi:selectManyMenu>
The problem is neither the validator nor converter are called. I also have validator and converter classes, each annotated with @FacesValidator('validator.testItem') and @FacesConverter("converter.testItem"), respectively. They are being picked up correctly, because if I move the <f:validator> and <f:converter> tags inside the composite component, underneath <composite:insertChildren> everything works fine, but I'd rather expose these to clients than hardcode them. Is there something about the way insertChildren works when using editableValueHolder? To get this working, I could just make the converter and validator IDs part of the interface, but that loses some flexibility for passing attributes to the converters and validators.
<f:converter for>to a value which you already got right in<f:validator for>, it works just fine for me on Mojarra 2.2.12. - BalusC