There is some problem when i check username and validate it against password from my database.After checking password from request.getParamter() it should say "You have been successfully login"... Perhaps I am getting my own else block message"Incorrect Password..." which means there is some problem with the password thing. Here is my servlet code
response.setContentType("text/html");
PrintWriter out= response.getWriter();
String uname= request.getParameter("txtuname");
String pass= request.getParameter("txtpass");
Connection con =null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:SQL","sa","mith1234");
String select="select Password from sign_up where U_Name=\'"+uname+"\'";
Statement st= con.createStatement();
ResultSet rs= st.executeQuery(select);
if(rs.next())
{
//out.println(pass);
//out.println(rs.getString(1));
if(rs.getString(1).equals(pass))
{
out.println("You have been successfully logged in"+uname);
}
else
{
out.println("Incorrect Password");
}
}
}
catch(Exception e)
{
out.println(e);
}
}
When i say out.println(rs.getString(1)) it is giving me the correct output.... Any kind of help appreciated!!!!