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



Home Answers Viewqa JSF-Questions java server pages
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


ramya
java server pages
1 Answer(s)      4 years and 11 months ago
Posted in : Java Server Faces Questions


code for jsp login page if user forgot password reminding password with hint question.the table login is created in database

Advertisement
View Answers

February 6, 2010 at 3:18 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:

<%@page 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:
java server pages - Java Server Faces Questions
java server pages  code for jsp login page if user forgot password reminding password with hint question.the table login is created in database  Hi Friend, Try the following code: 1)email.jsp: Enter Email
Introduction to the JSP Java Server Pages
source code. Introduction to JSP Java Server Pages or JSP... applications.   JSP Tutorials - Introducing Java Server Pages... JSP termed as Java Server Pages is a technology introduced by Sun
Advertisements
Java Server Pages(JSP)
Java Server Pages(JSP)     ... and platform-independent. The JavaServer Pages specification extends the Java Servlet API... dynamic web content on the server using HTML, and XML templates, and Java code
JSP - Java Server Pages
JSP JSP stands for Java Server Pages. JSP is Java technologies for creating dynamic web applications. JSP allows the developer to embed Java code inside HTML. It makes the development of dynamic web application very easy in Java
Tutorials - Java Server Pages Technology
Tutorials - Java Server Pages Technology   ... server-side Java a very exciting area. JavaServer Pages - An Overview.... The JavaServer Pages specification extends the Java Servlet API
linking of pages in java
a register page how can i do this in java (applet ie frames)i made to pages one for login and other for register pls rply   Java linking two pages...linking of pages in java  i made a login form accountno: password
java pages run
java pages run  how do we run jsp file in the browser. do we need to install server. could it be run on the xamp server   You need Apache Tomcat Server to run the jsp code over it. Follow these steps to run the simple
EasyEclipse Server Java
EasyEclipse Server Java       EasyEclipse Server Java For development of server-side Java applications, such as JavaServer Pages, EJBs and Web Services. EasyEclipse
Java Server Pages (JSP)
Java Server Pages (JSP) In this tutorial we are going to give you over view of JSP. What is JSP ? JSP is java based technology by using that you can... processed by the server. It is built on top of Java Servlets API, so as servlets
java code for registration and login pages, mysql as a bankend.
java code for registration and login pages, mysql as a bankend.  please send me the java code for registration and login pages and to store the data in mysql
why jsp pages are not working on linux but java application is working in windows - JSP-Servlet
why jsp pages are not working on linux but java application is working in windows  java web application jsp pages are not showing the fileds corectly on linux server but same application is working on windows.why
Tomcat Web Server
Tomcat Web Server       Introduction to the Tomcat web server Tomcat is an open source web server developed by Apache Group. Apache Tomcat is the servlet
proxy server in java
proxy server in java  how to developed proxy server in java .. detail of what is proxy server
Introduction to Tomcat Server
and JavaServer Pages technologies. The Java Servlet and JavaServer Pages specifications...Introduction to Tomcat Server      ... server developed by Apache Group. Apache Tomcat is the servlet container
Introduction to the Tomcat web server
Reference Implementation for the Java Servlet and JavaServer Pages technologies. The Java Servlet and JavaServer Pages specifications are developed by Sun under... Introduction to the Tomcat web server   
Java Server - Java Server Faces Questions
Java Server login Session  I have site in which user logs in and uses the services... the session should be closed so i used the java script, In java script i used... the toolbar in the java script through window.open
java with brava server integaration
java with brava server integaration  how to integrate java with brava java client
java with brava server integaration
java with brava server integaration  how to integrate java with brava java client
java server - Development process
java server  Develop multi-threaded echo server and a corresponding GUI client in java
server side scripting java - JSP-Servlet
server side scripting java  I Very new to java server pages I am doing a project in java messaging service so in that i have a client on d server... on the server side i want that in the client side as pop up window
Java Connect to and FTP Server
Java Connect to and FTP Server  What is the code for Java Connect to and FTP Server? How to establish a connection to FTP server in Java? Thansk... the apache commons library to connect/login to FTP server. Link of complete example
Client Server Java app
Client Server Java app  I developed a client server based java... computer whereas the server program is on server computer. This works in my... heroku techniques for java but its hard for me to understand
jsp pages
jsp pages  I am using 3 jsp pages in an application.. 1.login.jsp 2.checkuser.jsp:is connected to databse..from this page im giving path to search.jsp 3.search.jsp:Here we need fetch data from data base..do u want to connect
chat server in java - RMI
chat server in java  how develope a chat server in java language,not standalone application,i want to develpoe a web base application,please give me a idea,code, this application deployed in a netwok  Hi Friend
HTML pages.
HTML  pages. Description : HTML is a hypertext markup language. Every HTML page has two part one head part another is body. It will  run on browser. Anything available in head will not display on browser. Body part is used
server with two port - Java Server Faces Questions
server with two port  Hello, want to write two port server socket program using Java, (i.e. single server program which is listening on two ports... respectively. If C1 send object to the server (using the connection to 3122 port
how to save web pages in a partcular document in html format using java.. - Java Beginners
how to save web pages in a partcular document in html format using java..  i have to save a particular web page in a folder in html format using java. the url will be the input of the program. the program when run will first
java server on linux ystems
java server on linux ystems  hi.. i use linux... i want to remotely login into another linux system using java and then execute commands over that system.....how can i do this using java..password of host is known to us
JAVA SERVER PAGE
JAVA SERVER PAGE  hi, i want to know what is the need of JSP......and i want to get clear about all tech related to java instead of webapplications(Dynamic web project). because ajax,jsp,servelet..many tech like this i heard
JavaServer Pages (JSP) Roseindia
JavaServer Pages (JSP) is used to develop dynamic web content on the server using HTML, XML templates, and Java code. JSP is extensively used because... pages that get compiled into Java servlets the first time they are invoked. JSP
chat server in java - JavaMail
chat server in java  sir i was ask u question related to the chat server,and you has given a answer,but sir i want to make a network based chat server ,in network base chat server ,there is no use of the AWT,SWING,in server side
Advertisements
 

 

 

DMCA.com