JSF 自定义复合组件 input.xhtml
<cc:interface>
<cc:attribute name="validator"/>
</cc:interface>
<cc:implementation>
<h:inputText validator="#{cc.attrs.validator}"/>
</cc:implementation>
*.xhtml
<l:input value = ... validator="#{testValidator.validator}"/>
爪哇代码
@ManagedBean
公共类 TestValidator {
public void validator(FacesContext context, UIComponent component, Object value) throws ValidatorException {
System.out.println("Call validator");
}
}
属性未发现异常:
validator="#{testValidator.validator}": The class 'TestValidator' does not have the property 'validator'.
如何解决这个问题呢?我最后的方式: