问题是这样的
现在在页面1.html内通过js调用servlet,在servlet内处理完一些数据后要跳转到2.html页面上
可是不知道为什么一直都跳转不成功,还一直停留在1.html上面(servlet调用成功了)
下面是我的servlet的doGet方法
public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
response.setContentType("text/html");
//处理数据

response.sendRedirect("2.html");//这里改成http://www.baidu.com都还是停留在1.html上
}
各位帮帮忙,在线等

解决方案 »

  1.   

    注意你提交的方式是doGet
    最好把doPost 里面也设置下doGet
      

  2.   

    在public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { 
    doGet();//调用此方法再试试
    }
      

  3.   

    你在转发前System.out.println("ssss");下,看能否正常输出。。 
      

  4.   

    把  method方法改成  method="post"   或把哪句话写在dopost里  试试
      

  5.   

    应该是你的提交方式有问题,建议提交都用post.
      

  6.   

    你可以在doPost()的方法里面
    调用doGet()的这个方法
    在设个断点调试看看。。