Difference between forward and include of RequestDispatcher
来源:互联网 发布:网络测试仪使用方法 编辑:程序博客网 时间:2024/05/16 05:24
forward is used to forward a request, that is control is transfered tothe new servler/jsp. u shud take care to not put any our.println()statements in the servlet from where u plan to call forward method. infact u cant even fire response.getWriter() method in this case. u canonly do that in the servlet to which the control is bein fwded
include - means that the new servlet/jsp will be procesed and anyout.println()/html stuff will be included and then control will comeback to the servlet/jsp that called include method.
RequestDispatcher接口所定义的forward()方法可以将HTTP请求转送给其他Web资源(例如Servlet、JSP或HTML)进行处理,并产生HTTP回应。
调用forward()方法时必须注意下列两点:
1. 在HTTP回应被“确认”(committed)以前才能调用forward()方法(这里的“确认”是指将HTTP回应的内容主体送回用户端),否则将拋出IllegalStateException异常。
2. 调用forward()方法后,原先存放在HttpResponse对象中的内容将会自动被清除.
RequestDispatcher接口的include()方法与forward()方法非常类似,惟一的不同在于:利用include()方法将HTTP请求转送给其他Servlet后,被调用的Servlet虽然可以处理这个HTTP请求,但是最后的主导权仍然是在原来的Servlet。换言之,被调用的Servlet如果产生任何HTTP回应,将会并入原来的HttpResponse对象。
- Difference between forward and include of RequestDispatcher
- Difference between JSP forward and redirect.
- RequestDispatcher include与forward
- ruby learning-- Difference between require and include
- RequestDispatcher中的forward和include
- Difference between JSP include directive and JSP include action
- difference between data() and c_str() of basic_string
- Difference between OnPaint and OnDraw of MFC
- the difference between require() and include() in php
- difference of top and left between Javascript and Jquery
- The difference between (()) and ().
- difference between "<" and "<<"
- The difference of overriding between C# and Java
- the difference between ClientID and ID of web control
- String and some of the difference between StringBuffer
- The difference of SE Detail UI between 2.4 and 4.0
- one mail for difference between LOCAL_LDLIBS and LOCAL_SHARED_LIBRARIES of Android
- The difference of Post-Secondary education between USA and China
- 我也在CSDN有家啦
- ubuntu9.10中vim方向键异常问题的解决
- Linq 使用总结
- 面向对象编程中的继承,多态,封装。
- 制造执行系统MES现状及发展趋势探讨
- Difference between forward and include of RequestDispatcher
- 求教高手文件上传问题
- Using iPhone's NSURLConnection class
- 301重定向的实现方法
- MY FEELING
- 一个301重定向案例
- 选择保存文件夹
- Linux下Tomcat的启动、关闭、杀死进程
- VB mschart控件的使用