What is the difference between controller and handler in Java – spring MVC?

Spring MVC documentation sometimes says "handler" or "request handler" For example, http://docs.spring.io/autorepo/docs/spring/4.0.4.RELEASE/javadoc-api/org/springframework/web/servlet/handler/SimpleUrlHandlerMapping.html Say:

Sometimes it says controller For example, there is one called org springframework. web. servlet. mvc. Interface of controller( http://docs.spring.io/spring-framework/docs/2.5.x/api/org/springframework/web/servlet/mvc/Controller.html ).

My question is: are the controllers and handlers the same?

Solution

Generally speaking, the controller is the handler, but the handler is not necessarily the controller

For example, httprequesthandler, webrequesthandler and messagehandler are all handlers that can use dispatcher servlet (@) controller is the handler that executes the web request and returns the view.)

In short, handler is just a term. It is neither a class nor an interface It is responsible for performing the mapping

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
分享
二维码
< <上一篇
下一篇>>