请求调度概念的包含和转发机制之间的区别? [英] Difference between include and forward mechanism for request dispatching concept?
问题描述
转发():这可以通过Request& amp; amp;
ServeletContext。
将来自servlet的请求转发到服务器上的另一个资源
(servlet,JSP
文件或HTML文件)。转发是在
服务器端完成的,没有客户的知识。
Forward() : This can be done in two ways by Request & ServeletContext. Forwarding a request from a servlet to another resource (servlet, JSP file, or HTML file) on the server. Forward is done at server side, without the client's knowledge.
当你调用转发请求时,请求被发送到
另一个$ b服务器上的$ b资源,没有通知客户
不同的资源将处理请求。这个
流程完全在网络容器中发生
。
When you invoke a forward request, the request is sent to another resource on the server, without the client being informed that a different resource is going to process the request. This process occurs completely with in the web container.
简单
包括:将在我们当前文件中包含另一个文件
include: will include another file in our current file
转发:将当前请求转发到转发页面
forward: will forward the current request to the forwarding page
推荐答案
主要区别在于当你使用 forward 时,控件被转移到你正在调用的下一个servlet / jsp,而 include 保留使用当前servlet的控件,它只包括调用servlet / jsp完成的处理(比如执行任何out.println或其他处理)。
The main difference is that when you use forward the control is transferred to the next servlet/jsp you are calling, while include retains the control with the current servlet, it just includes the processing done by the calling servlet/jsp(like doing any out.println or other processing).
这篇关于请求调度概念的包含和转发机制之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!