change password servlets



Share on Google+Share on Google+

change password servlets
2 Answer(s)      8 years ago
Posted in : JSP-Interview Questions
View Answers

January 20, 2009 at 11:12 PM

I dont have the time to write the code. But i can give you the idea, to write the code.
In view part you have to create a link for change the password page in that page there should be a three text box, one for old password and another for new password and the last one for the confirm password.
You also have validation for these text boxes (ex. should not be blank, newpassword and confirm password should be same).
In database there should be a field for password for curresponding user.
The new password and the confirm password should be same. After submiting the page you have to update the database( Update the value for the password).

Try this hope it will help you.

January 22, 2009 at 1:02 AM

Hi friend,

i am sending a code to change password by servlet

import java.sql.*;
import javax.sql.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class UpdateServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/test";;
String username = "root";
String password = "root";
String query = "UPDATE users SET users.password = \"bunty\" WHERE users.username = \"Sandeep\";";
showTable(driver, url, username, password, query, out);
public void showTable(String driver, String url, String username, String password, String query, PrintWriter out) {
try {
Connection connection = DriverManager.getConnection(url, username, password);
Statement statement = connection.createStatement();
query = "SELECT * FROM users;";
ResultSet resultSet = statement.executeQuery(query);
while( {
out.print("User Name= " + resultSet.getString("username"));
out.print("Password= " + resultSet.getString("password"));
out.print("Email ID= " + resultSet.getString("email"));
}catch(ClassNotFoundException cnfe) {
System.err.println("Error loading driver: " + cnfe);
}catch(SQLException sqle) {
System.err.println("Error connecting: " + sqle);
} catch(Exception ex) {
System.err.println("Error with input: " + ex);



Related Tutorials/Questions & Answers:
change password servlets - JSP-Interview Questions
change password servlets  hi all, i need the codes to create a change... a link for change the password page in that page there should be a three text box... you.  Hi friend, i am sending a code to change password by servlet
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
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
Change Password - JSP-Servlet
Change Password  Hi all, Please kindly help me with jsp code and explanations to enable me write a change password program. This program will connect to mssql database 2000. Thanks
change password - JSP-Servlet
change password  hi, my problem is as follows: i am creating... for a user. this web page consists of changing the password for the existing user. it look like this: current password new password confirm new password SUBMIT
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
how to change password into one jsp to another jsp
how to change password into one jsp to another jsp  i have two jsps in one jsp i give one password and confirm password, in another jsp i want change...; Here is a jsp code that change the password. 1)change.jsp: <html>
Change Password Code in JSP
Change Password Code in JSP In this example we will see how to change password...(""); ChangePasswordForm.jsp <html> <head> <title>Change password in jsp<...;strong>Change password in JSP form</strong></h2> <body> <
Change root password of MYSQL using Java
Change root password of MYSQL using Java In this tutorial, you will learn how to change the root password of MYSQL database using java code. For every... to change the root password with the known password. For this, we have created
Looking for change password in iphone application sdk using sqlite
Looking for change password in iphone application sdk using sqlite  i am trying to change old password in my iphone application my code is below...) == SQLITE_OK) { NSString *querySQL = [NSString stringWithFormat: @"SELECT password
Password  make a program which ask ask the username and password * in this format. in C language
in servlets   There are four ways of authentication:- HTTP basic... authentication In HTTP basic authentication the server uses the username and password send by theclient. The password is sent using simple base64 encoding but it?s
servlets  what is the duties of response object in servlets
servlets  why we are using servlets
what are advantages of servlets  what are advantages of servlets   Please visit the following link: Advantages Of Servlets
Servlets  How to edit and delete a row from the existing table in servlets
servlets  How do you communicate between the servlets?   We can communicate between servlets by using RequestDespatcher interface and servlet chaining
what is the architecture of a servlets package  what is the architecture of a servlets package   The javax.servlet package provides interfaces and classes for writing servlets. The Servlet Interface The central
Servlets  How to check,whether the user is logged in or not in servlets to disply the home page
Password History - JSP-Servlet
Password History  I am using servlets and in my application i want to maintain password history.It means on password change My application should check previous 5 password so that new password can't be same to 5 old password
. Anyways, please visit the following links:
servlets  why we require wrappers in servlets? what are its uses? Please explain   These wrappers classes help you to modify request...://
servlets  How to open and read the contents of a text file in servlets?   Please visit the following link: Read text file using Servlet
servlets   Hi what is pre initialized servlets, how can we achives?   When servlet container is loaded, all the servlets defined in the web.xml file does not initialized by default. But the container receives
servlets why do we need web-inf directory in web application  why do we need web-inf directory in web application? means what's the benefits of doing so
Servlets and
Servlets and   Sir...! I want to insert or delete records form oracle based on the value of confirm box can you please give me the idea.... thanks
which are the differ ways you can communicat between servlets  which are the differ ways you can communicat between servlets   Different ways of communicating between servlets:- 1)Using RequestDispatcher object. 2
package supports the development of servlets that use the HTTP protocol. The classes... javax.servlet.GenericServlet and serves as the base class for HTTP servlets. HttpServlet-Request
what are sessions in servlets  what are sessions in servlets   A Session refers to all the request that a single client makes to a server...:
the servlets
what is diff between generic servlets and httpservlets  what is diff between generic servlets and httpservlets   Difference between GenericServlet and HTTPServlet: 1)GenericServlet belongs to javax.servlet package
regarding the user usage and habits. Servlets sends cookies to the browser client...://


Advertisement null