I have a problem with GWT client-side validation using hibernate validation annotation @Email. I put this annotation on entity getter and when I check constrains violations (agfter I put this email: test@test), than I get an error message "not a well-formed email address". But when I test this on server-side, than this email address pass. Have anyone of you this problem?
The EmailValidator
implementation provided by Hibernate Validator uses java.util.regex.Pattern
to validate input strings. Since GWT cross-compiles Java code to Javascript, it only supports JS-level RegEx
and as such does not allow java.util.regex.Pattern
to be used.
As such, if you see the GWT re-implementation of EmailValidator
, you'll see that this validator in particular is not implemented/supported: http://grepcode.com/file/repo1.maven.org/maven2/com.google.gwt/gwt-user/2.4.0/org/hibernate/validator/constraints/impl/EmailValidator.java?av=h