0

0 with eclipse and glassfish, in fact i have added a custom validator to validate emai address, and i am getting class not found exception. although i have registered in faces.config too.

here is my validator code

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);
        }
    }

i registerd in faces.config

<validator>

<validator-id>emailvalidator</validator-id>
<validator-class>com.jsf.validators.EmailValidator</validator-class>
</validator>

does someone know what is the problem in it.

user1626766
  • 13
  • 1
  • 1
  • 6
  • 1
    This could just be your IDE integrated servlet container is out of sync with your project. Try doing a clean and rebuild before publishing your project. Then you should inspect the servlet container deployment directory for the missing class file to verify that it exists. – maple_shaft Sep 19 '12 at 11:38
  • The complete stacktrace would also be helpful to confirm if you're really understanding the concrete problem. **Unrelated** to the concrete problem, please carefully review if your email regex fits in the World Domination plans of your website. You're namely blocking all non-latin users such as Cyrillic, Hebrew, Sanskrit, Chinese, Japanese, etc. See also http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address/1931322#1931322 – BalusC Sep 19 '12 at 12:37
  • @maple_shaft thanx for reply, i have cleaned and rebuilt it, it is working fine now. – user1626766 Sep 20 '12 at 04:46
  • @BalusC thanx for the link you mentioned it is really helpful. – user1626766 Sep 20 '12 at 04:48

0 Answers0