Validating the password field

Validating the password field

When the validate method returns back to the registration page the password field get cleared there by asking again one more time to enter the password field at the time of re-submitting the form

*newuser.jsp*

<%@page contentType="text/html" pageEncoding="UTF-8"%> <%@taglib prefix="s" uri="/struts-tags" %> Registration

RegAction.java

public class RegAction extends ActionSupport{

private String fname;
private String lname;
private String uname;
private String pwd;
private String gender;
private String country;
private String hobbies;
private String address;

public String getAddress() {
    return address;
}

public void setAddress(String address) {
    this.address = address;
}

public String getCountry() {
    return country;
}

public void setCountry(String country) {
    this.country = country;
}

public String getFname() {
    return fname;
}

public void setFname(String fname) {
    this.fname = fname;
}

public String getGender() {
    return gender;
}

public void setGender(String gender) {
    this.gender = gender;
}

public String getHobbies() {
    return hobbies;
}

public void setHobbies(String hobbies) {
    this.hobbies = hobbies;
}

public String getLname() {
    return lname;
}

public void setLname(String lname) {
    this.lname = lname;
}

public String getPwd() {
    return pwd;
}

public void setPwd(String pwd) {
    this.pwd = pwd;
}

public String getUname() {
    return uname;
}

public void setUname(String uname) {
    this.uname = uname;
}



@Override
public String execute()
{

    return SUCCESS;

}

@Override
public void validate()
{

    if(getFname().equals("")){
    addFieldError("fname", "Enter First Name");
    }
    else if(getLname().equals("")){
    addFieldError("lname", "Enter Last Name");
    }
    else if (getUname().equals("")){
    addFieldError("uname", "Enter USer Name");
    }

    else if(getPwd().equals("")){
    addFieldError("pwd", "Enter Password");
    }

// else if(getGender().equals("")){ // addFieldError("gender", "Select any Gender"); // }

    else if(getCountry().equals("")){
    addFieldError("country", "Select any Country");
    }

    else if(getHobbies().equals("")){
    addFieldError("hobbies", "Select a Hobby");
    }

    else if (getAddress().equals("")){
    addFieldError("address", "Enter the Address");
    }


}

}

struts.xml

/Login/login.jsp /Login/newuser.jsp

View Answers

Ads









Related Tutorials/Questions & Answers:
Validating the password field
Validating the password field  When the validate method returns back to the registration page the password field get cleared there by asking again one more time to enter the password field at the time of re-submitting the form
validating username and password from database
validating username and password from database  Hello sir, i am developing a login page. i want that when i fill data in text fields. it validate data from database. if enter data is match from database. page goes to next page
Advertisements
validating username and password in servlet and redirect to login page with error message if not valid
validating username and password in servlet and redirect to login page... and password in my servlet against database and if not valid want to display error message saying "Invalid username and password" in my login page. please help
How to change password mask field?
How to change password mask field?  I want to use '*' character in password. thanks in advanced............   password masking character in the standard password field can't be changed
Password Field in HTML
Password Field in HTML       When users type characters in a password field, the browser displays asterisks or bullets instead of the characters. Password text field is same
Java Password Field
Java Password Field In this section we will discuss how to use password field in Java. To create a password field in Java Swing JPasswordField is used... of text field which allows to enter password only. Due to the security reason
Validating XML
Validating XML  Hi, I have a string containing data in XML format. I have to Validate this xml data. Is there any method in java that allows strings as input to validate xml?   Please visit the following link: http
Password
Password  make a program which ask ask the username and password * in this format. in C language
validating web pages
validating web pages  How to validate HTML web pages
Validating image size
Validating image size  How to validate image size to 2MB in javascript which is updating to mysql database
validating email id
validating email id  how to validate the email id ?   <html> <script> function validate(){ var e=document.getElementById('email').value; var regExpObj = /(\d\d\d)-\d\d\d\d\d\d\d\d/; var reg
validating credentials and displaying error message in login .jsp if not valid
validating credentials and displaying error message in login .jsp if not valid  hi, i want to validate user name and password against my database table if not valid i have to display error message in my login page.how to do
foget password
is user login ,second is new user and third is forget password in java using netbeans.so please help me to write the code for forget password button.forget password form have three field that is userid ,security question and answer of those
forgot password?
forgot password?  forgot password
password check
password check  how to check sighup passowrd and login password
change password
change password  how to change password in the login form.... by giving options to user like this old password, new password.. pls help
Reset Password
Reset Password  coding for reset password
retype password
retype password  coding for retype password
forget password?
forget password?  can anyone help me? how to create a module of forget password?the password can reset by generate random password and send to user's email..i develop the php system using xampp and dreamweaver
forget password?
forget password?  can anyone help me? how to create a module of forget password?the password can reset by generate random password and send to user's email..i develop the php system using xampp and dreamweaver
forget password
forget password  codding for forget password using spring framework
password change
password change  Hi , I am using jsf and trying to write a code to change the password of a user . Ihave to retrine userid fromdata base how to do that using session
3D PASSWORD
3D PASSWORD  HI i would like to know abt where the 3d password in india used and also few info about the 3d password pls rply some1 as soon as possible
Password validation
password and confirm password are same or not Validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here
Password validation
Password validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here is a code that accepts the current password
Password validation
Password validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here is a code that accepts the current password
Password validation
Password validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here is a code that accepts the current password
Password validation
Password validation  Hi. I have a change password form. In that i have to check the values given in the new password and confirm password are same or not. Please help.   Here is a code that accepts the current password
forget password
forget password  can i get coding for forgot password in jsp, need using javamail also cannot.. what should i do?? Thx
password - JDBC
password  as memeber of our site, recently he forget his password now he want a new password from us. so overcome with this problem i have to send his password to his any emailid to once again login with this new pasword so
Forget Password
Forget Password  How i get my forget password through mail?   Please visit the following links: http://www.roseindia.net/jsf/richfaces/ http://www.roseindia.net/jsf/richfaces/developing-jsp-files.shtml

Ads