Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to validate an email address in ADF/JSF

orlandokOct 14 2009 — edited Jun 26 2012
I am trying to validate and inputText component, the field is an email address so I need to validate the format is correct.
I am attempting to use the af:validateRegExp tag but i am having problems, anything use as a RegExp seems to fail.
It always reports that the email address is invalid, but I am using valid email addresses.


<af:inputText value="#{bindings.EmailAddress.inputValue}"
label="#{bindings.EmailAddress.label}"
required="true"
columns="#{bindings.EmailAddress.displayWidth}"
rows="1">
<f:validateLength minimum="6"/>
<af:validator binding="#{bindings.EmailAddress.validator}"/>
<af:validateRegExp pattern="^([a-zA-Z0-9_\-\.]+)@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$ " noMatchMessageDetail="&quot;The value {1} is not a valid email address: &quot;"/>
</af:inputText>

The RegExp Pattern below is not displayed correctly in the post above.
Pattern is '^[\\w\\.-]+@([\\w\\-]+\\.)+[A-Z]{2,4}$"


I am using the following website to obtain the regular expression for checking email
[http://www.tipsntracks.com/117/validate-an-email-address-using-regular-expressions.html|http://www.tipsntracks.com/117/validate-an-email-address-using-regular-expressions.html]

Is there something I am missing?

Thanks in advance

Orlando

Edited by: orlandok on Oct 14, 2009 10:38 AM
This post has been answered by Arunkumar Ramamoorthy-Oracle on Oct 14 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 24 2012
Added on Oct 14 2009
11 comments
8,006 views