spring web framework
转载自 《architectural-patterns》
Spring framework 实现了一种 Front controller 设计模式,现在 translate these in Chinese.
The Dispatcher Servlet component is the single servlet that functions as the front controller and handles all incoming requests. The Dispatcher Servlet then calls Handler Mapping in order to find an object that could service the request.
Dispatcher Servlet 组件是一个servlet 可以处理所有的请求并且调用 Handler Mapping 来找到一个可以处理请求的controller.
The request is then given to the controller object so that the Dispatcher becomes free to perform functions associated with the fulfilment of business logic as per the user's request.
The controller object returns an encapsulated object that contains the model object and view object. This is represented by the ModelandView class.
Controller 对象返回一个封装了model 和view object 的modelandview 对象
If the ModelandView contains the logical name of the view, the Dispatcher Servlet calls the View Resolver to get details of the actual view object from its logical name. The Dispatcher Servlet then gives the model object to the view object so that it can be displayed to the end user.
在modelandview 对象包含了view的逻辑 名称。Dispacher servlet 调用 view resolver 得到真实的view 对象,然后传递给view object 展示给最终用户。