Share on Google+Share on Google+

Pradeep
password
1 Answer(s)      7 years ago
Posted in : JDBC
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 how i can do this ?

Ads

View Answers

February 6, 2010 at 3:19 PM


Hi Friend,

Try the following code:

1)email.jsp:

<html>
<form method="post" action="recoverpass.jsp">
Enter Email Id:<input type="text" name="emailid"><input type="submit" value="Submit">
</form>
</html>

2)recoverpass.jsp:

<[email protected] import="java.sql.*"%>
<%
String pass="";
String email=request.getParameter("emailid");
try{

Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root";, "root");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select password from login where email='"+email+"'");

if(rs.next()){
pass=rs.getString("password");
}
else{
out.println("Invalid");
}
System.out.println(pass);
rs.close();
st.close();
con.close();
}
catch(Exception e){}
%>
<form method="post" action="mail.jsp">
Enter Alternate Email Id:<input type="text" name="altEmail">
<input type="hidden" name="id" value="<%=email%>">
<input type="hidden" name="pass" value="<%=pass%>">
<input type="submit" value="Submit">
</form>

3)mail.jsp:
<%
String email=request.getParameter("id");
String emailto=request.getParameter("altEmail");
String pass=request.getParameter("pass");
%>
<html>
<body>
<table border="1" width="50%" cellpadding="0" cellspacing="0">
<tr><td width="100%">
<form method="POST" action="mail.jsp">
<table border="1" width="100%" cellpadding="0" cellspacing="0">
<h1>Mail API</h1>
<tr><td width="50%"><b>To:</b></td><td width="50%"><input type="text" value="<%=emailto%>" name="to" size="30"></td></tr>
<tr><td width="50%"><b>From:</b></td><td width="50%"><input type="text" name="from" size="30"></td> </tr>
<tr><td width="50%"><b>Subject:</b></td><td width="50%"><input type="text" name="subject" size="30"></td></tr>
<tr><td width="50%"><b>Description:</b></td><td width="50%"><textarea name="description" type="text"
cols="40" rows="15" size=100>Your Password is: <%=pass%>.
Email id= <%=email%>
Password= <%=pass%>
</textarea>
</td></tr>
<tr><td><p><input type="submit" value="Send Mail" name="sendMail"></td></tr>
</table>
</form>
</td></tr>
</table>
</body>
</html>

And the following link will help you to send this mail.

http://www.roseindia.net/mail/sending-an-email-in-jsp.shtml
http://www.roseindia.net/javamail/

Thanks









Related Tutorials/Questions & Answers:
Password
Password  make a program which ask ask the username and password * in this format. in C language
forgot password?
forgot password?  forgot password
Advertisements
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
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
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 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
Forgot password
Forgot password  hi i want to develop a code for when user clicks on forgot password then the next page should be enter his mobile no then the password must be sent to his mobile no...! Thanks in advance Nag Raj
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
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
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
password - Security
password  How can i do password encript and decript in java  Hi friend, Code to encript and decript password in java import... password= "Hello"; System.out.println("input " + password
secure password
secure password   Respected Sir We need to write a function which accepts a given password and returns ââ?¬Å?ACCEPTEDââ?¬Â? or ââ?¬Å?REJECTEDââ?¬Â? based on the following rules: Passwords must consist of a mixture
secure password
secure password   Respected Sir We need to write a function which accepts a given password and returns ââ?¬Å?ACCEPTEDââ?¬Â? or ââ?¬Å?REJECTEDââ?¬Â? based on the following rules: Passwords must consist of a mixture
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
java password function
java password function  secret password function
Forgot Password of Application
Forgot Password of Application  Forgot Password of Application through servlet and jsp
password encryption in php - PHP
password encryption in php  example of password encryption in php
coding for forgot password
coding for forgot password  coding for forgot password
array password - Java Beginners
array password  i had create a GUI of encryption program that used the array password. my question is can we do the password change program? i mean we change the older password with the new password
password validation with special character
password validation with special character  how to validate password with special character using java script
Tutorials   
Java Spring Hibernate Struts Training how to retrieve text and images from mysql database and show on html page using jsp servlet How to install Neo4j on Ubuntu 15.10? please help me in these prog MYSQL - mysql copy table to another table example by creating new table solution for mapping hibernate and pojos from net beans through database Connect GWT application with Oracle inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store This code have created jTable that connected with a database.every cell of last column have a button.But this button doesn't work properly.Where is the error java program Java Database Program jdbc Database connection class in a live project ..?? What is JDBC architecture? Unable to Create DSN for excel to ms access importing data and edit that data Database Scrolling Buttons how to use foreign key in java How to delete content of a log file from linux terminal? JSP-Oracle connectivity Student Management System Java code for Saving Marathi (Indian local language ) in Mysql and retrieving the same crud operations with foreign key constraint. I really need help with this assignment question Please help me out Please Backup Failed Mysqldump Got Errno 28 On Write Upgrade MySQL 5.1 to 5.5 in cpanel mysqldump all databases com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'jpa.sequence' doesn't exist persistence xml class element persistence.xml for MySQL MySQL JDBC Driver pom dependency code Blob column jdk6 and oracle 8i connexion oracle 8i et jdk6 java [ cannot retrive date from sql ] why?? Order Entry System How to threow timeout exception when DB is not responding How to threow timeout exception when DB is not responding This is the employee form to add data to mysql database but I got error of NullPointerException, Is this write code please give me feedback as soon as possible make a method which takes user name & pwd as parameter & validate them against the database. If the corresponding user exist return true otherwise false. prabhakar validating credentials and displaying error message in login .jsp if not valid JDBC jdbc jdbc code register servlet vibhu connectiondetails from vibhu

Ads

 
Advertisement null

Ads