How can I validate two fields like password and confirm password in Struts 2?

Viewed 2043

I am doing web application in that I want to validate two fields in the JSP form. In registration filed I have so many fields. In that I want to validate password and confirm password fields.

Below is my code:

Action Class:

@Length(min = 6, max = 20)
@Column(name = "PERSON_PASSWORD", nullable = false, length = 20)
public String getPassword() {
    return password;
}

@Length(min = 6, max = 20)
@Column(name = "PERSON_CONFORMPASSWORD", nullable = false, length = 20)
public String getConformPassword() {
    return conformPassword;
}

Now, how can I validate the two fields contain the same data?

3 Answers
Related