Home Answers Viewqa JavaScriptQuestions String password Validation

 
 


Sujitha
String password Validation
1 Answer(s)      9 months ago
Posted in : JavaScript Questions

Hi. I have a HTML coding in that I have to check whether the value given in the 2 password fields are same or not. Its for the form changing password. If they are not same it should give a message.

View Answers

August 16, 2012 at 3:41 PM


Here is a code that accepts the current password, New password and conform password from the user and change the password.

1)change.jsp

<html>
<script>
function validate(){
if(document.f.new.value!=document.f.confirm.value){
alert("New Password and Confirm Password should be same! Re-enter confirm-password!");
document.f.confirm.value="";
return false;
}
return true;
}
</script>
<form name="f" action="changePassword.jsp" method="post" onsubmit="return validate();">
<table>
<tr><td>Current Password</td><td><input type="password" name="current" ></td></tr>
<tr><td>New Password</td><td><input type="password" name="new"></td></tr>
<tr><td>Confirm Password</td><td><input type="password" name="confirm"></td></tr>
<tr><td><input type="submit" value="Change Password"></td></tr>
</table>
</form>
</html>

2)changePassword.jsp

<%@page import="java.sql.*"%>
<%@page import="java.io.*"%>
<%
String currentPassword=request.getParameter("current");
String Newpass=request.getParameter("new");
String conpass=request.getParameter("confirm");
String connectionURL = "jdbc:mysql://localhost:3306/test";
Connection con=null;
String pass="";
int id=0;
try{
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(connectionURL, "root", "root");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from login where password='"+currentPassword+"'");
if(rs.next()){
id=rs.getInt(1);
pass=rs.getString(3);
}
System.out.println(id+ " "+pass);
if(pass.equals(currentPassword)){
Statement st1=con.createStatement();
int i=st1.executeUpdate("update login set password='"+Newpass+"' where id='"+id+"'");
out.println("Password changed successfully");
st1.close();
con.close();
}
else{
out.println("Invalid Current Password");
}
}
catch(Exception e){
out.println(e);
}
%>









Related Pages:
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
String Validation
String Validation changing password  Hi. I have a HTML coding in that I have to check whether the value given in the 2 password fields are same or not. Its for the form changing password. If they are not same it should give
String Validation
String password Validation  Hi. I have a HTML coding in that I have to check whether the value given in the 2 password fields are same or not. Its for the form changing password. If they are not same it should give a message
String Validation
String Validation  Hi. I have a HTML coding in that I have to check whether the value given in the 2 password fields are same or not. Its for the form changing password. If they are not same it should give a message.   
String Validation
String Validation  Hi. I have a HTML coding in that I have to check whether the value given in the 2 password fields are same or not. Its for the form changing password. If they are not same it should give a message.   
validation
; private String name; private String password; private String gender...;</td> </tr> <tr> <td>Password :</td> <td><form:password path="password" /><
password validation with special character
password validation with special character  how to validate password with special character using java script
Username password
with the validation, so that if the username and password match it will continue... that checks whether the username and password is valid or not. If the user...("Password:"); text2 = new JPasswordField(15); SUBMIT=new JButton("SUBMIT
validation
validation  How to validate username and password in a login screen
validation.....
validation.....  hi.......... thanks for ur reply for validation code. but i want a very simple code in java swings where user is allowed to enter only numerical values in textbox , if he enters string values then it should
Login Password Validation iPhone / iPAD
Login Password Validation iPhone / iPAD  HOW TO WRITE A TEST CASE TO SET THE VALIDATION FOR LOGIN AND PASSWORD FIELD IN OBJECTIVE C, IOS.   @implementation LoginViewTests - (void)testPasswordFieldIsNotEmpty
Validation
; static DefaultTableModel model; public static void main(String[] args) { String...(); String columnName = table.getModel().getColumnName(0); headerRenderer.setText...); JLabel label=new JLabel("JTable validation Example",JLabel.CENTER); JPanel panel
Validation
; <b>Password</b> :<input type="Password
Validation
; <b>Password</b> :<input type="Password
Validation
actionPerformed(ActionEvent ae){ String value1=text1.getText(); String value2...(Exception e){} } }); } } class FormDemo{ public static void main(String arg
string validation in php - PHP
string validation in php  Can you please post a example of PHP Built-in String Validation Functions
user validation
page if username & password is invalid but it does redirect only if the username is valid and password invalid.i want know wer i am going wrong... ServletException,IOException{ String userlog = request.getParameter("textfield
jQuery password validation
jQuery password Validation : jQuery "equalTo: "#password" " is the method to validate or check password if the element is empty (text input... validation we can check that password and verify password are equal.   
Login validation doubt
Login validation doubt  Hi, 1)login.jsp: <%@page import="java.sql.*"%> Username: Password: 2)check.jsp: <% String user=request.getParameter("user"); String pass=request.getParameter("pass"); if(user.equals
login page validation
validations Email validation and password email should be in correct format and valid password in java   import java.awt.*; import javax.swing....:"); t1=new JTextField(20); l2=new JLabel("Enter Password: "); t2=new
validation problem in struts - Struts
username nd password in a string only d last values in database is coming in d... = af.getUsername(); String password = af.getUserpassword(); String...validation problem in struts  hi friends... m working on one
change password servlets - JSP-Interview Questions
for the confirm password. You also have validation for these text boxes (ex. should...:3306/test"; String username = "root"; String password = "root"; String query... void showTable(String driver, String url, String username, String password, String
password - Security
password  How can i do password encript and decript in java  Hi friend, Code to encript and decript password in java import... { public static void main(String[] args) throws Exception{ String
validation - Swing AWT
validate a registration form through swings..fields like user,password,email... = new JTextField(20); label4 = new JLabel(); label4.setText("Password...(ActionEvent ae){ String value1=text1.getText(); String value2=text2.getText
JSP data base validation
;/table> </form> <% String driver = "com.mysql.jdbc.Driver"; String url = "jdbc:mysql://localhost:3306/record"; String user = "root"; String password... string with database n also how its notify that entered data exists already
validation using validator-rules.xml - Struts
String name=""; private String password=""; public String getName() { return...; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password
Mandatory Fields Validation - Java Beginners
= "com.mysql.jdbc.Driver"; String userName = "amar"; String password = "amar123... username and password. I would like a message to be displayed when both or one field... and passoword is name of the password textbox.  Hello, you can do
NSURL Validation
NSURL Validation  How to validate a NSURL string using special character validation
struts2.2.1 validation Interceptor example
String userName; private String password; public... password; } public void setPassword(String password) { this.password = password; } public String
struts2.2.1 Login validation example.
userName; private String password; public String...; } public String getPassword() { return password; } public void setPassword(String password
Validation doubt
Validation doubt  hi..... thanks for the other validation code. I have got that and implemented in my code but i have a doubt in that. As we try to put string values its not allowing to do tht it gives us message its right
form validation
want validation code,username minimum 8 char,password length must >6,and one...; <tr><td>password:</td><td><input type="password" name="password" /></td></tr> <tr><
Jdbc Login Page Validation using Combobox
= request.getParameter("username"); String password = request.getParameter("password...(); String query = "select uname,password from dblogin where uname='"+name...Jdbc Login Page Validation using Combobox  I got Login By this code i
Jdbc Login Page Validation using Combobox
(); String name = request.getParameter("username"); String password = request.getParameter("password"); try{ String driver = "org.postgresql.Driver...=con.createStatement(); String query = "select uname,password from dblogin where uname
Jdbc Login Page Validation using Combobox
(); String name = request.getParameter("username"); String password = request.getParameter("password"); try{ String driver = "org.postgresql.Driver...=con.createStatement(); String query = "select uname,password from dblogin where uname
Example of struts2.2.1 client side validation.
firstname; private String password; public String getFirstname... password; } public void setPassword(String password) { this.password...Example of struts2.2.1 client side validation. In this example, you will see
Password encryption and decryption
name=request.getParameter("name"); String password=request.getParameter("pass...(); cipher = Cipher.getInstance(algorithm); String input = password... where id='1'"); String str=""; if(rs.next()){ str=rs.getString("password
jsp login code ... when username , drop down box and password is correct
jsp login code ... when username , drop down box and password is correct  i need a jsp code for login.... when username password and dropdown box...; var password=document.form.pass.value; if(username==""){ alert("Enter Username
Authentication of password - Swing AWT
BufferedReader(new InputStreamReader(System.in)); String password...Authentication of password  System level authentication of password.... How the Printed password gets converted into the asteric (*) mark
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
Decrypt an encrypted password in JSP
"); > String > pass=request.getParameter("password"); > String > cpass=request.getParameter("confirm_password"); > String > gender...Decrypt an encrypted password in JSP   How to decrypt an encrypted
forgot password - Struts
forgot password  i want to proper code for forgot password, means how to send password into email id if i forgot my password   import... java.util.*; public class Mail { public static void main(String args
joptionpane validation
joptionpane validation  import javax.swing.*; import java.util.regex.*; public class joptionpane { public static void main(String[] args){ int category_user = 0; boolean aa = false; do{ String
Password - Java Beginners
charecter just as typing password in E-mail.ID without using applet... can we do... { public static void main(String args[]){ JFrame f = new JFrame... = Box.createHorizontalBox(); rowTwo.add(new JLabel("Password")); rowTwo.add(new
Help needed for Form Validation please help!
("username"); String pass = request.getParameter("password...Help needed for Form Validation please help!  I have created a page.../password combination . Problem arises while validating the Sign up part as after
Password
Password  make a program which ask ask the username and password * in this format. in C language

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.