getRequestDispatcher("index.jsp").forward(...)为什么没有反应

幻玄 2016-06-26 01:49:50
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

request.setCharacterEncoding("utf-8");
String name = request.getParameter("username");
String pwd = request.getParameter("password");

if(name.equals("admin")&&pwd.equals("123456")){
request.getSession().setAttribute("name", name);

request.getRequestDispatcher("index.jsp").forward(request,response);
System.out.println("111");
}
}

为什么111输出了,但是页面无反应,不跳转
...全文
117 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
persuit666 2016-06-27
  • 打赏
  • 举报
回复
request.getRequestDispatcher("index.jsp") 这个应该是写你index.jsp那个后台的控制器而不是具体的页面

5,655

社区成员

发帖
与我相关
我的任务
社区描述
Web开发应用服务器相关讨论专区
社区管理员
  • 应用服务器社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧