Results 1 to 3 of 3
  1. #1
    ravian is offline Senior Member
    Join Date
    Nov 2007
    Posts
    115
    Rep Power
    0

    Default Validating email address

    I have a textfield on a frame and the user enters his email address in it. I want simple validation for it. I know how to do it using javascript on HTML pages but don't know how to do it on a frame.

    Please help me out of this.

    Cheers

  2. #2
    collins is offline Member
    Join Date
    Dec 2007
    Posts
    3
    Rep Power
    0

    Default

    Hi,
    You can do the validation in swings same as Javascript using "Regular Expression". In java, you have two classes called "Pattern" and "Matcher". using which you can do this.

    Example:-

    String str=Regular Expression
    String str2="Email Address to be validated"

    Pattern p=Pattern.compile(str);
    Matcher m=p.matcher(str2);

    if(m.find()==true){}
    else {}

    Post Reply if u have doubts.

  3. #3
    ravian is offline Senior Member
    Join Date
    Nov 2007
    Posts
    115
    Rep Power
    0

    Default

    Thanks collins. I guess I have to explore regex API because I am not into regular expressions.

    Thanks once again.

Similar Threads

  1. send email using JMS
    By Heather in forum Advanced Java
    Replies: 9
    Last Post: 01-07-2009, 03:04 PM
  2. Validating email address!
    By rameshraj in forum Advanced Java
    Replies: 1
    Last Post: 02-18-2008, 09:39 AM
  3. validating selection list in struts!
    By rameshraj in forum Web Frameworks
    Replies: 2
    Last Post: 02-13-2008, 01:21 PM
  4. validating a string for numbers and letters?
    By lockmac in forum New To Java
    Replies: 1
    Last Post: 08-09-2007, 09:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •