I am trying to create a user registration page using jsp with email confirmation . It is nothing but the user account has to be activate after the mail confirmation only . Could any one please help me by sharing code or any links ......
Thanks in advance .
Regards,
Anand.A
E-Mail : [email protected]
Cool DudePosted Apr 30, 2013, 8:02 AM
I Just Post The Code Of Login Here Check It Out :
Login.jsp
Loginhandler.jsp
<%
String password=request.getParameter("psd");
String email=request.getParameter("eme");
boolean flag=false;
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","user","pass");
Statement stmt = con.createStatement();
String query = "select * from userlogin where email='"+ email +"'";
ResultSet rs = stmt.executeQuery(query);
while(rs.next())
{
String pass= rs.getString(2);
if( pass.equals(password)) {
flag=true;
break;
}
}
if (!flag){
RequestDispatcher rd=request.getRequestDispatcher("loginfail.jsp");
rd.forward(request, response);
}
else{
session.setAttribute("email", rs.getString(3));
session.setAttribute("user", rs.getString(1));
session.setAttribute("who", rs.getString(4));
%>
<%
String u="";
String e="";
u=(String)session.getAttribute("user");
e=(String)session.getAttribute("email");
if (u=="d" && e=="d"){%>
View Profile
<% } else if (u!="dance"){
%>
View Profile
<%
}%>
Go To Home Page
<% }%>
Login.jsp
<%@page import="java.sql.*" %>
<%! public Connection con;%>
<%
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:userlogin");
}
catch (ClassNotFoundException ce)
{
System.out.println(ce);
}
catch (SQLException se)
{
System.out.println(se);
}
catch (Exception e)
{
System.out.println(e);
}
%>
I hope U Can Done ...