Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Struts Validating the password field
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Sidhu
Validating the password field
0 Answer(s)      a year and 8 months ago
Posted in : Struts


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


Advertisement
View Answers

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
you get a password field in struts
you get a password field in struts   How do you get a password field in struts
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
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
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 a HTML
validating a HTML  What are the reasons for validating a HTML
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 a form before data is entered.
validating a form before data is entered.  How can I avoid validating a form before data is entered
validating - Swing AWT
validating   hi another problem i am facing in swing is that is i have got many textfeilds ex: Roll No: Name: Address: so Roll No TextField have to Contains only Numbers. Name TextFields have to contain only
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 date in javascirpt - Development process
Validating date in javascirpt   Hi Friends, Can u plz give sample code for validating date in javascript using textbox.((dd--mm--yyyy format) Thank u in advance  Hi, The following code may be useful
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
validating text fields - Swing AWT
validating text fields  hi i am using NETBEANS IDE so when i want to validate TEXTFEILDS if one textfield is blank then it should focus on that particular textfield so help me with this plz..... /* * To change this template
forgot password?
forgot password?  forgot password
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
Validating date in javascript - Java Interview Questions
Validating date in javascript   Hi Deepak, Can u give sample code validating date in javascript using text box. thank u in advance  In what format you are going to enter the date in Text box (i.e : dd/mm
password check
password check  how to check sighup passowrd and login password
Validating Number Very Urgent - JSP-Servlet
Validating Number Very Urgent  Respected Sir/Madam, I am R.Ragavendran.. I want u to insert the coding for validating number in the place... field...then u can u use this... function Validate
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
retype password
retype password  coding for retype password
Reset Password
Reset Password  coding for reset password
forget password
forget password  codding for forget password using spring framework
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
Validating Emp ID Reply - JSP-Servlet
Validating Emp ID Reply  Respected Sir/Madam, I am Ragavendran.R.. Thanks for your quick response.. Actually I need to check whether Emp ID... ur field name... var anum=/(^\d+$)|(^\d+\.\d+$)/ if (anum.test(id)) return
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
 

 

 

DMCA.com