jaya
jsp updation
1 Answer(s)      5 years and 5 months ago
Posted in : Development process
hi..
how to change the password using jsp and update in the backend
Advertisement
View Answers

February 25, 2010 at 12:51 PM


Hi Friend,

Try the following code:

1)password.jsp:

<form method="post" action="chanPass.jsp">
<table>
<tr><td>Enter Old password: </td><td><input type="password" name="old"></td></tr>
<tr><td>Enter New password: </td><td><input type="password" name="new"></td></tr>
<tr><td>Enter Confirm password: </td><td><input type="password" name="confirm"></td></tr>
<tr><td><input type="submit" value="Change Password"></td></tr>
</table>
</form>

2)chanPass.jsp:

<%@page import="java.sql.*"%>
<%
String oldpass=request.getParameter("old");
String newpass=request.getParameter("new");
String confirm=request.getParameter("confirm");
if(newpass.equals(confirm)){
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test";, "root", "root");
Statement st=con.createStatement();
int i=st.executeUpdate("update login set password='"+newpass+"' where password='"+oldpass+"'");
out.println("Password changed successfully.");

st.close();
con.close();
}
catch(Exception exc){
System.out.println(exc);
}
}
else{
out.println("Your New Password and Confirm Password does not matches");
}
%>

Thanks









Related Tutorials/Questions & Answers:
Updation and deletion - JSP-Servlet
Updation and deletion   How to provide updation and deletion in data view of jsp  Hi Friend, Please visit the following links: http://www.roseindia.net/jsp/user-search.shtml http://www.roseindia.net/servlets
jsp updation - Development process
jsp updation  hi.. how to change the password using jsp and update in the backend   Hi Friend, Try the following code: 1)password.jsp: Enter Old password: Enter New password: Enter Confirm password
Advertisements
automatic updation of a form - JSP-Servlet
automatic updation of a form   Sir, I need the code for if we fill the details in one page(form) that details should be updated automatically in another table like page.Please provide the code for this problem in JSP or java
updation of data in mysql
updation of data in mysql  http://www.roseindia.net/answers/viewqa/PHP/20822-Edit-the-record-.html sir , i want the above code as retreive of data from mysql ,but based on subject code(varchar) instead of id and my table format
updation problem during transaction to ms-access
updation problem during transaction to ms-access  Hey friends I am a beginner to java,and my problem is related to updation query in ms... in text fields and then updation is made in these textboxes and then updation query
updation problem during transaction to ms-access
updation problem during transaction to ms-access  Hey friends I am a beginner to java,and my problem is related to updation query in ms... in text fields and then updation is made in these textboxes and then updation query
updation problem during transaction to ms-access
updation problem during transaction to ms-access  Hey friends I am a beginner to java,and my problem is related to updation query in ms... in text fields and then updation is made in these textboxes and then updation query
updation problem during transaction to ms-access
updation problem during transaction to ms-access  Hey friends I am a beginner to java,and my problem is related to updation query in ms... in text fields and then updation is made in these textboxes and then updation query
query - JSP-Servlet
query  code that manage updation n deletion in one page.../jsp/edituser.jsp?id='+id,'mywindow','width=500, height=350,toolbar=no,resizable...://localhost:8080/examples/jsp/deleteuser.jsp?id='+id,'mywindow','width=500, height
JSP
what is JSP forward tag for  what is JSP forward tag for   It forwards the current request to another JSP page. Below is the syntax for the same:- <jsp:forward page="...url..." /> We can also forward parameter
Jsp
Jsp  Can I implement interface in jsp
jsp
jsp  how to create jsp page
jsp
jsp  how to include two jsp page
JSP
JSP  How to run jsp program in eclipse
jsp
jsp  how jsp translated into servlets
jsp
jsp  write a code for jsp file generator to generate a jsp page automatically taking html page as input
jsp
jsp  how to create a table in oracle using jsp and the table name is entered in text feild of jsp page
JSP
JSP  Hi, What is JSP? What is the use of JSP? Thanks   Hi, JSP Stands for Java Server Pages. It is Java technology for developing web applications. JSP is very easy to learn and it allows the developers to use Java
jsp
jsp   what is the basic necessities reguired for running jsp using JDBC bridge?? and how to write a jsp code to access the detail present in microsoft access pls send link regarding above
jsp
jsp  how to connect the database with jsp using mysql   Hi Friend, Please visit the following links: http://www.roseindia.net/jsp/connectjspwith_mysql.shtml http://www.roseindia.net/jsp/Accessingdatabase-fromJSP.shtml
JSP
JSP  FILE UPLOAD-DOWNLOAD code USING JSP
jsp
jsp  how to write hindi in jsp and store in database as unicode
jsp
jsp  how to pass jsp variable to an html page
jsp
jsp  how to upload image through csv format in jsp
jsp
jsp  I Want complete note on JSP servlet
jsp
jsp  how to delete data from database using jsp
jsp
jsp  code for jsp automatic genration using html
jsp
jsp  why jsp is translated into servlet?pls describe precisly
JSP
JSP  relevant difference between servlet and jsp in 1 line
jsp
jsp  how to write a servlet and jsp program for user login form