[每当我单击提交时,它都会重定向到空白页,但该网址可以正常工作我对我的响应标签是否错误感到困惑
protected void doPost(HttpServletRequest request,HttpServletResponse response)throws ServletException, IOException {
Connection con=connector.getConnection();
String username = request.getParameter("username");
String password = request.getParameter("password");
String message = null;
String url = null;
try {
PreparedStatement ps = con.prepareStatement( "Select * from data Where username=?'" + username + "' and password=?'" + password + "';");
ps.setString(1, request.getParameter("username"));
ps.setString(2, request.getParameter("password"));
ResultSet rs = ps.executeQuery();
if(rs.next()) {
RequestDispatcher rd=request.getRequestDispatcher("practice1.jsp");
rd.forward(request,response);
}
else {
message="Invalid Input Please Try Again";
request.setAttribute("message", message);
request.setAttribute("url", url);
}
}
catch(SQLException ex){
message="ERROR"+ex.getMessage();
ex.printStackTrace();
}
PreparedStatement ps = con.prepareStatement(“从数据中选择*,其中username =?和password =?”);ps.setString(1,用户名);ps.setString(2,password);