aspose file tools*
The moose likes Struts and the fly likes How to validate email id with special characters + Validation FrameWork Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to validate email id with special characters + Validation FrameWork " Watch "How to validate email id with special characters + Validation FrameWork " New topic
Author

How to validate email id with special characters + Validation FrameWork

Maneesh Chauahn
Ranch Hand

Joined: Mar 06, 2006
Posts: 48
Hi All,
I have a question on the struts validation framework. As i am using the email rule to validate the email. When i am
put a@yahoo.com in the email field on the JSP then email rule of the validation framework , correctly validate the email id
but when i put �a@yahoo.com ( � is a special character) in the email field on the JSP then this email get failed.

As i checked in the code of the validation framework, in the code email can check character from in between
^[\\000-\\177] range , and it may possible that � has character value than 177 .

So can we handle the email id that contains the characters whose value are greater than 177.

Is there any plugin that support of special characters in the email id


Thanks in the advance from your prompt answer

Maneesh Chauhan
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
If you'd like to define your own rules for validating an email address, I'd suggest using the mask validation rule. With this rule, you can match the input against any regular expression you specify. That's really all the email rule is anyway is anyway: a special case of the match rule. For more information see the Struts documentation.


Merrill
Consultant, Sima Solutions
Joan Horta Tosas
Ranch Hand

Joined: Feb 01, 2007
Posts: 59
You know that UTF8 email addresses are still no standard? I think some servers are implementing it, but that addresses can only be used inside that server domain; when an email needs to "get out" of it, it needs to be translated into ASCII (by the moment). So is there any real reason you must accept this kind of emails (like an app that can only be used inside the same domain)?
Maneesh Chauahn
Ranch Hand

Joined: Mar 06, 2006
Posts: 48
Hi All,
With the mask property you can validate the characters that can be entered in the field, which is fine ...But when you going to validate through the email validate rule then in that case we have faliure of the email id


Thanks in advance for your prompt answer

Maneesh Chauhan
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
What I'm telling you is to use the mask rule instead of the email rule, and not use the email rule at all.
omkar patkar
Ranch Hand

Joined: Aug 25, 2005
Posts: 231
H Maneesh,

Merill is RIGHT ! ... you can write your own regularExpression for email as per your requirements. You can refer to some sample examples for regular expressions on the internet and use them in your mask. You can also refer to http://www.regular-expressions.info/

... hope this helps !


Thanks
mkar Patkar


Thanks and Regards
Omkar Patkar (SCJP 1.4)[url]http://javacollectionsnotes.blogspot.com[/url] | [url]http://omkar-myscjpexp.blogspot.com[/url]
Nyanas Kandhan
Ranch Hand

Joined: Jan 27, 2009
Posts: 35
For an example on email validation refer here. Struts Email Validation Example


regards,
Nyanaskandhan
 
 
subject: How to validate email id with special characters + Validation FrameWork