Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Validation JSF2.0中的复合组件验证_Validation_Jsf 2_Facelets_Composite Component - Fatal编程技术网

Validation JSF2.0中的复合组件验证

Validation JSF2.0中的复合组件验证,validation,jsf-2,facelets,composite-component,Validation,Jsf 2,Facelets,Composite Component,我在JSF2.0中使用了复合组件 <composite:interface> <composite:attribute name="inputId"/> <composite:attribute name="labelValue"/> <composite:attribute name="inputValue" /> <composite:attribute name="required" />

我在JSF2.0中使用了复合组件

<composite:interface>
    <composite:attribute name="inputId"/>
    <composite:attribute name="labelValue"/>
    <composite:attribute name="inputValue" />
    <composite:attribute name="required" />
    <composite:attribute name="requiredMessage" />
</composite:interface>
<composite:implementation>
    <div class="control-group">
        <h:outputLabel for="#{cc.attrs.inputId}" value="#{cc.attrs.labelValue}" class="control-label" />
        <div class="controls">
            <h:inputText id="#{cc.attrs.inputId}" value="#{cc.attrs.inputValue}" required="#{cc.attrs.required}" requiredMessage="#{cc.attrs.requiredMessage}" />
        </div>
    </div>
</composite:implementation>

我需要对它进行一些验证(是编号、长度验证等)
那么,我该怎么做呢?

您需要在
中定义所需的输入,并为其附加验证器


...
标签基本上告诉我们,任何
必须应用到
UIInput
组件上,其
id
目标中指定的
相同。因此,您可以按如下方式注册它:

<my:input ...>
    <f:validateLength for="input" ... />
</my:input>

您需要在
中定义所需的输入,并为其附加验证器


...
标签基本上告诉我们,任何
必须应用到
UIInput
组件上,其
id
目标中指定的
相同。因此,您可以按如下方式注册它:

<my:input ...>
    <f:validateLength for="input" ... />
</my:input>