1

我想将验证器附加到复合组件,并且我希望它附加到内部的每个子组件:

<cc:interface>
  <cc:attribute name="validator"
                method-signature="void f(javax.faces.context.FacesContext,
                                         javax.faces.component.UIComponent,
                                         java.lang.Object)"
                targets="child1 child2"/>
  <cc:editableValueHolder name="child1"/>
  <cc:editableValueHolder name="child2"/>
</cc:interface>
<cc:implementation>
  <h:inputText id="child1"/>
  <h:inputText id="child2"/>
</cc:implementation>

所以在页面上我有:

<xxx:mycomponent validator="#{bean.validationMethod}"/>

验证按预期工作,但 JSF 也会抛出一条消息: ..../form.xhtml validator="#{bean.validationMethod}": The class 'my.package.Bean' does not have the property 'validationMethod'.

我怎样才能摆脱这个消息?

4

0 回答 0