1

我在嵌套复合组件和将验证器传递给嵌套组件中的 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>

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

4

0 回答 0