0

Hi,

I am developing web application using jsf2.0.
In this case, I wish to validate the email field with the help of import org.hibernate.validator.Email;

But it is not working, How to validate the email fileld...

Thank.:)

3
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by manikandan_dani
0

>But it is not working, How to validate the email fileld.

I want to know why your code is not working. Please post source code (bean).

0
import java.sql.*;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import org.hibernate.validator.Email;
import org.hibernate.validator.Length;
import org.hibernate.validator.Max;
import org.hibernate.validator.Min;

import org.hibernate.validator.NotNull;
import org.hibernate.validator.Pattern;

/**
 *
 * @author laser
 */
@ManagedBean(name = "NewuserBean")
@RequestScoped
public class NewuserBean {

    Connection con;
    Statement ps;

    /** Creates a new instance of NewuserBean */
    public NewuserBean() {
    }
    private String firstname;
    private String lastname;
    @Email
    private String email;
    private String password;
    private String cpassword;
    private String domain;
    private String message;

    public void setMessage(String message) {
        this.message = message;
    }

    public String getMessage() {
        return message;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public String getFirstname() {
        return firstname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }

    public String getLastname() {
        return lastname;
    }

    
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPassword() {
        return password;
    }

    public void setCpassword(String cpassword) {
        this.cpassword = cpassword;
    }

    public String getCpassword() {
        return cpassword;
    }

    public void setDomain(String domain) {
        this.domain = domain;
    }

    public String getDomain() {
        return domain;
    }

    
}

Edited by manikandan_dani: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

0

You so realise there's no way to ensure an email address is real and "valid"?
An address entered might be correct according to some rules for some email system but invalid for another.
It might be valid for some system but not exist.
It might be valid and exist but not be reachable for whatever reason.
It might be valid, exist, and be reachable but configured to not accept incoming messages.

etc. etc. etc.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.