0使用eclipse和glassfish,实际上我已经添加了一个自定义验证器来验证emai地址,并且我发现了类未找到异常。虽然我已经注册了faces.config。
这是我的验证码
public static final String EmailPattern= "^[_A-Za-z0-9-]+(\\." +
"[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*" +
"(\\.[A-Za-z]{2,})$";
public void validate(FacesContext context, UIComponent component,
Object value) throws ValidatorException {
matcher = pattern.matcher(value.toString());
if(!matcher.matches())
{
FacesMessage message = new FacesMessage("Please enter a valid email address");
message.setSeverity(FacesMessage.SEVERITY_ERROR);
throw new ValidatorException(message);
}
}
我在faces.config中注册
<validator>
<validator-id>emailvalidator</validator-id>
<validator-class>com.jsf.validators.EmailValidator</validator-class>
</validator>
有人知道它的问题是什么。