该死的servlet,为什么我重定向不了

来源:互联网 发布:学校奖学金算法 编辑:程序博客网 时间:2024/05/01 04:26

这是servlet里面的部分内容:

public void doPost(HttpServletRequest request, HttpServletResponse response)

throws ServletException, IOException {
//request.getRequestDispatcher("hehe.jsp").forward(request, response);
System.out.println(request.getParameter("username")+"-----"+request.getParameter("content"));
response.setContentType("text/html; charset=utf-8");
response.sendRedirect("test.html");

return;

这是某jsp页面的js部分内容:

$("tr:first").click(function(){
alert("hehe");
$.post("Test",{
username :  "aaaaa" , 
content :  "hehehehehe"  
});
});

点击了对应的部分之后,myselipse输出如下;(第二行内容)

信息: Server startup in 816 ms
aaaaa-----hehehehehe

由此说明我数据都传过来了,为何浏览器没有重定向到test.html呢?

求大神解答orz。。。。


原创粉丝点击