Regular expression email validation in GWT

1,123 views
Skip to first unread message

creativepragmatic

unread,
Jun 24, 2011, 1:37:09 AM6/24/11
to Google Web Toolkit
Hello,

I am trying to validate a form using gwt-validation but have not been
having any success validating the email field of a POJO. The field is
annotated as follows:

@NotNull
@Pattern(regexp = ".+@.+\\.[a-z]+")
private String email;

Whenever Pattern is annotated to the above code, it fails after the
following line that I modeled after Gwt_validation_sample:

Set<ConstraintViolation<Email>> violations =
validator.validate(email);

I have added the following JARs to the classpath:

dom4j-1.6.1
freemarker-gae-2.3.18
guava-r09
gwt-validation-2.0-preview-r199
javassist
reflections-0.9.5-RC2
reflections-0.9.5-RC2.one
slf4j-api-1.6.1
validation-api-1.0.0.GA-sources
validation-api-1.0.0.GA

I am not sure if they are all required.

Thank you in advance for any help,

Orville

Piro

unread,
Jun 25, 2011, 10:38:14 AM6/25/11
to Google Web Toolkit
I had problems with validation framework so i changed it to gwt-vl
http://gwt-vl.sourceforge.net/
You can try it too. It is perfect framework, but it works. It is not
using annotations so it is more verbose.
More about email regex: http://www.regular-expressions.info/email.html

On 24. Jún, 07:37 h., creativepragmatic <creativepragma...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages