<h:inputSecret value="#{user.password}" required="true">
<f:validator validatorId="example.jsf.PasswordValidator"/>
<f:attribute name="pattern" value=".+[0-9]+"/>
</h:inputSecret>
Code
public void validate(FacesContext context,
UIComponent component,
Object obj)
throws ValidatorException {
....
String pattern = (String)
component.getAttributes().get("pattern");
....
}
This sample works. But the attribute is added to UIComponent inputSecret. But logically, the attribute should belong to "validator". There may be better solution like using f:param.
No comments:
Post a Comment