The Java EE frontcontroller is the same as the dispatcher servlet of spring

If you view the Java EE frontcontroller sequence diagram, the controller will delegate the request to the dispatcher. The document says:

In spring MVC, dispatcherservlet acts as frontcontroller (as described in Craig walls). This servlet delegates the request to other controllers, which in turn calls the appropriate service class (for processing the request), and then returns the instance of modelandview to dispatcherservlet again

So roughly this is the usual way to travel:

Customer – > dispatcher servlet – > controller – > service – > Dao

If you compare this flow with the Java EE frontcontroller pattern sequence diagram, it looks like the dispatcher servlet is not the real frontcontroller

What do you say about this?

Solution

I would say that the dispatcherservlet populates the volumes of the front-end controller and scheduler However, instead of directly delegating to the view, the dispatcher servlet is delegated to another controller This allows you to better separate your presentation from your business logic In the "pure" front - end controller example, you might have to add some business logic to the view

In short, the dispatcher servlet achieves the same goal as the front controller mode But it does allow you to add another layer of controller to the scheduler and deviate slightly from it I think it's a good thing

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>