0
Вот мой JSF
форма электронный код раздела:Email uniquness проверки в JSF
(Registration.xhtml
)
<p:inputText id="email" required="true" label="Email" size="20" value="#{registrationBean.email}">
<f:validateRegex pattern="([^[email protected]]+)(\.[^[email protected]]+)*@([^[email protected]]+\.)+([^[email protected]]+)"/>
<f:validator id="uniqueEmailValidator"/>
</p:inputText>
<h:message for="email"/>
И это мой валидатор класс:
@FacesValidator("uniqueEmailValidator")
public class UniqueEmailValidator implements Validator {
@Override
public void validate(FacesContext fc, UIComponent uic, Object value) throws ValidatorException {
if (value == null) {
return;
}
String email = (String) value;
CustomerService cService = new CustomerService();
if (!cService.exists(email)) {
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "mail is already in use.", "error"));
}
}
}
Я получил эту ошибку для запуска приложения:
/Registration.xhtml @49,73 <f:validator> A validator id was not specified. Typically the validator id is set in the constructor ValidateHandler(ValidatorConfig)