use validateRequired through composite component
I'm trying to forward "f:validateRequired" validator through a composite component without using required attribute.
How to get its value inside of my component ?
<aa:myComponent id="specificNotice" value="#{edit.specificNotice}">
<f:validateRequired for="specificNotice" disabled="#{empty param['form:save']}"开发者_如何学C />
</aa:myComponent>
Thanks.
The for
attribute should refer the id
of the input component inside the composite component implementation. The input component in turn should be declared as <cc:editableValueHolder>
inside the composite component interface.
So,
<my:input value="#{bean.input}">
<f:validateRequired for="input" />
</my:input>
with
<cc:interface>
<cc:editableValueHolder name="input" />
</cc:interface>
<cc:implementation>
<h:inputText id="input" value="#{cc.attrs.value}" />
</cc:implementation>
should do.
精彩评论