简体   繁体   English

Spring MVC中的Dispatcher-servlet是控制器吗?

[英]Is Dispatcher-servlet in Spring MVC - Controller?

If Dispatcher-Servlet is not the controller then who is? 如果Dispatcher-Servlet不是控制器,那么谁是控制器?

Controller is the one who manages the request and by this definition, it should be the controller. 控制器是管理请求的人,根据此定义,它应该是控制器。

What is the Model and View in this case? 在这种情况下,模型和视图是什么?

The DispatcherServlet follows the Front Controller design pattern. DispatcherServlet遵循前端控制器设计模式。 The C in MVC refers to the page controller which retreives the data from the model (your services) and passes it to the view for rendering. MVC中的C是指页面控制器,该页面控制器从模型(您的服务)中检索数据并将其传递到视图以进行渲染。

The purpose of the DispatcherServlet is to determine the page controller that is supposed to handle the request and coordinates the model and the view DispatcherServlet的目的是确定应该处理请求的页面控制器,并协调模型和视图

Its an advanced servlet which can handle request mapping , locale resolution , view resolution , content negotiation etc 它是一个高级Servlet,可以处理请求映射,区域设置解析,视图解析,内容协商等

The Dispatcher servlet is the bit that "knows" to call that method when a browser requests the page, and to combine its results with the matching JSP file to make an html document. 当浏览器请求页面时,Dispatcher servlet是“知道”调用该方法的位,并将其结果与匹配的JSP文件组合在一起以创建html文档。 How it accomplishes this varies widely with configuration and Spring version. 它如何完成此操作因配置和Spring版本而异。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM