| Author |
Email validation does not work
|
Sudha Joish
Greenhorn
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: Validation.xml: 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. Thanks -- $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" classname="org.apache.struts.validator.FieldChecks" method="validateEmail" methodParams="java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest" depends="" msg="errors.email"> is there in your validator-rules.xml Sandy
|
Adios
|
 |
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
Greenhorn
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: .... java.lang.reflect.InvocationTargetException 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.
|
 |
 |
|
|
subject: Email validation does not work
|
|
|