Hi Marcus. I am doing exactly the same but using a tapestry validator
so it handles server and client validation. the code is something
like:

public class Email implements Validator<Void, Object> {

public void validate(Field field, Void constraintValue,
MessageFormatter formatter, Object value) throws ValidationException {
        if (value == null || StringUtils.isBlank(value.toString()))
            throw new ValidationException(buildMessage(formatter, field));
        
        if (!EMAIL_PATTERN.matcher(value.toString()).matches())
            throw new ValidationException(buildMessage(formatter, field));
   }

i still have to add the client side validation (still not so sure
how). Once is working i will post it.



On 5/15/07, Marcus <[EMAIL PROTECTED]> wrote:
Hi Juan,

If u do it, may u share the code with us?
On server side, we're using this regular expression.

import java.util.regex.Pattern;
public class EmailValid {
    public static boolean isValid(String email)
    {
        return Pattern.matches(
"([A-Za-z0-9]+[._-]*)+[A-Za-z0-9]+@([A-Za-z0-9-]+\\.)+[A-Za-z]{2,6}",
email);
    }
}

Thank's
Marcus


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to