这是我的servlet代码...
try {
HttpSession session=request.getSession(true);
String FN= (String)session.getAttribute("FN");
String h1= request.getParameter("h1"); //contains the password value
if(h1=="" || h1== null)
{
response.sendRedirect("PERROR.html"); // if no value in passwrd field
}
else{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:dsn2");
Statement st=con.createStatement();
String UNM= (String)session.getAttribute("uname");
String query= "select * from img_pwd where uname='"+UNM+"' and pwd='"+h1+"')";
// validating from the table img_pwd
ResultSet r= st.executeQuery(query);
if(r.next())
{
con.close();
response.sendRedirect("ACCOUNT.jsp"); //success, go to dashboard
}
else
{
response.sendRedirect("PERROR.html"); // if the password-mismatches
}
}
} finally {
out.close();
}
并且表格“img_pwd”如下所示——
1. uname(nvarchar[50])
2. pwd(nvarchar[20])
所以我尝试调试,发现程序执行到了查询存储在字符串中的位置,但查询没有执行,程序的进度在存储查询字符串后停止....
我无法找出错误,需要帮助..