Validation JSF2.0中的复合组件验证
我在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" />
<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>