Получение неожиданного вывода в программу
Вот код:
String sql_1 = "select emp_id,password from regid";
ResultSet rs = st.executeQuery(sql_1);
while(rs.next())
{
if(((employee.equals(rs.getString("emp_id"))) && (password.equals(rs.getString("password"))))==true)
{
// String sql2="update regid set regid='"+Datastore.regIds.add(regId)+"' where emp_id='"+employee+"'";
// st.executeUpdate(sql2);
System.out.println("2> Employee Id : "+employee+" && Password : "+password);
System.out.println("3> This employee "+employee+" exsists in the database and registration-password id will be Updated");
// resp.setStatus(HttpServletResponse.SC_OK);
resp.setContentType("text/html");
PrintWriter out = resp.getWriter();
out.print("");
out.print("");
out.print("Policy Page");
out.print("");
out.print("");
String status = (String) req.getAttribute(ATTRIBUTE_STATUS);
if (status != null)
{
out.print("Status :"+status);
}
List devices = Datastore.getDevices();
if (devices.isEmpty())
{
out.print("No devices registered!");
}
else
{
out.print("" + devices.size() + " device(s) registered!");
out.print("");
out.print("");
resp.setStatus(HttpServletResponse.SC_OK);
out.print("");
out.print("");
// System.out.println(HTTP_STATUS);
System.out.println(HttpServletResponse.SC_OK);
getServletContext().getRequestDispatcher("/home").forward(req, resp);
}
out.print("");
resp.setStatus(HttpServletResponse.SC_OK);
}
else {
resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);
System.out.println(HttpServletResponse.SC_BAD_REQUEST);
System.out.println("4> This employee "+employee+" does not exsist in the database");
}
}
// rs.close();
}
Но я'Я получаю вывод, как, но яя поставил правильный emp_id & пароль (все ещепоказывает 4> + java.lang.illegalstateexception (нене знаю почему ?? :()):
1> Employee : P1 && Password : ppp
400
4> This employee P1 does not exsist in the database
2> Employee Id : P1 && Password : ppp
3> This employee P1 exsists in the database and registration-password id will be Updated
400
4> This employee P1 does not exsist in the database
любая идея ..... почему этопроисходит?