为了账号安全,请及时绑定邮箱和手机立即绑定

请求转发request.getRequestDispatcher("").forward()与PageContext.forward("");有什么区别呢?

请求转发request.getRequestDispatcher("").forward()与PageContext.forward("");有什么区别呢?

正在回答

2 回答

RequestDispacher,forward method taking request & response as parameter & while getting request dispatcher we are giving path for forward resource,

RequestDispacher rd = request.getRequestDispacher("/resource.jsp");rd.forward(request,response);


and while forwarding through PageContext we are giving resource path to parameter of forward method,
PageContext.forward("/resource.jsp");

we can use RequestDispacher in Servlet as well as Jsp
but PageContext we can use in only jsp.


0 回复 有任何疑惑可以回复我~
#1

拿馒头盖房子 提问者

非常感谢!
2016-01-05 回复 有任何疑惑可以回复我~

RequestDispatcher.forward() and PageContext.forward() are effectively the same.  PageContext.forward is a helper method that calls the RequestDispatcher method.(forward)

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

请求转发request.getRequestDispatcher("").forward()与PageContext.forward("");有什么区别呢?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信