如何将验证器传递给JSF 2中嵌套(!)复合组件中的inputtext

时间:2013-02-27 12:40:28

标签: jsf nested validation custom-component

我在嵌套复合组件和将验证器传递给嵌套组件中的inputtext时遇到以下问题:

包装器自定义组件( wrapper.xhtml ):

<cc:interface>
    <cc:attribute name="value" required="false" />
</cc:interface>

<cc:implementation>
    <h:panelGroup>
        <h:outputLabel value="TEST:"/>
        <temptest:input value="#{cc.attrs.value}">
            <cc:insertChildren/>
        </temptest:input>
    </h:panelGroup>
</cc:implementation>

嵌套的自定义组件( input.xhtml ):

<cc:interface>
    <cc:attribute name="value" required="false" />
    <cc:editableValueHolder name="input" targets="input" />
</cc:interface>

<cc:implementation>
    <h:inputText value="#{cc.attrs.value}" id="input" >
        <cc:insertChildren/>
    </h:inputText>
</cc:implementation>

将验证程序传递给嵌套自定义组件的试用版( pageXYZ.xhtml ):

<h:form>
...
    <temptest:wrapper value="#{bean.value}">
        <f:validateRequired for="input"/>
    </temptest:wrapper>
    <!-- this works:
    <temptest:input value="#{bean.value}"> 
        <f:validateRequired for="input"/>
    </temptest:input> -->
    <h:message for="input"/>
...
</h:form>

有没有办法将(一个或多个)验证器传递给嵌套的自定义组件?

0 个答案:

没有答案