wood burning stoves 2.0
The moose likes Struts and the fly likes Email validation does not work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Email validation does not work" Watch "Email validation does not work" New topic

Email validation does not work

Sudha Joish

Joined: Nov 07, 2003
Posts: 12
I use Struts 1.1 with Tomcat 5.0 as my webserver.
My JSP has 3 text boxes. All three can't be left empty and one of them is accepts an email address. I want this text box to be validated for "email" and "required".
Validation works for 'required', but doesnt work for 'email'. I am probably missing something here. Nothing happens abt the email check, it merely goes onto the next Action class - if the text box is not empty.
Please have a look at my code:

In struts_config.xml:

And in ApplicationResources.properties:

I checked validator_rules.xml. It does contain scripts to validate email.
What am I missing here? Please help.
-- $uDhA
sandy gupta
Ranch Hand

Joined: Jan 30, 2001
Posts: 228
All that you have posted up here is correct way to do it and it should be working, not sure why it is not. One thing comes to mind though. I am sure i am just being paranoid but still can you check if:
<validator name="email"
is there in your validator-rules.xml

David Yutzy
tumbleweed and gunslinger
Ranch Hand

Joined: Jun 29, 2001
Posts: 192
I have the same issue and yes, that is in the rule.xml.
Jeremy Cavagnolo

Joined: Sep 01, 2004
Posts: 1
I had the same problem with the email validation not working, and I found the following in tomcat's logs:


at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.commons.validator.Validator.validateFieldForRule(Validator.java:454)
at org.apache.commons.validator.Validator.validateField(Validator.java:544)


at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.NoClassDefFoundError: org/apache/oro/text/perl/Perl5Util
at org.apache.commons.validator.GenericValidator.isEmail(GenericValidator.java:420)
at org.apache.struts.validator.FieldChecks.validateEmail(FieldChecks.java:779)
... 41 more

I put the oro.jar in my webapp's lib directory, restarted, and email validation worked.
I agree. Here's the link: http://aspose.com/file-tools
subject: Email validation does not work
It's not a secret anymore!