首页 > 编程语言 > 详细

javaEE 转发 和 重定向

时间:2018-01-16 22:04:04      阅读:203      评论:0      收藏:0      [点我收藏+]

转发 两种方法:

1,request.getRequestDispatcher(getServletContext().getContextPath() + "/path").forward(request, response);//request是HttpServletRequest的对象

2,this.getServletContext().getRequestDispatcher(getServletContext().getContextPath() + "/path").forward(request, response);

重定向

1,response.sendRedirect(getServletContext().getContextPath() + "/path"); //response是HttpServletResponse的对象

javaEE 转发 和 重定向

原文:https://www.cnblogs.com/wf-l5201314/p/8297683.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!