方法response.sendRedirect()在我的程序中不起作用. 代码通过并成功打印out.println(“错误的用户”);但重定向到google paged不起作用. String id="java";try { query = "select Id from Users where Id= ?"; ps =Datab
          代码通过并成功打印out.println(“错误的用户”);但重定向到google paged不起作用.
String id="java";
try 
{
    query = "select Id from Users where Id= ?";
    ps  =Database.getConnection().prepareStatement(query);
    ps.setString(1, id);
    rs  =   ps.executeQuery();
    if(rs.next())
    {
        out.println(rs.getString(1));
    }
    else 
    {
        out.println("wrong user");
        response.sendRedirect("www.google.com");
    }
    rs.close();
}
catch(Exception e)
{
    //e.printStackTrace();
    System.out.print(e);
} 
 任何答案?
您应该在重定向后返回.response.sendRedirect("http://www.google.com");
return; 
 调用sendRedirect()后它不会自动返回.
