Handler mapping

We have learned that DispatcherServlet is the one that dispatches the request to the handler methods based on the request mapping; however, in order to interpret the mappings defined in the request mapping, DispatcherServlet needs a HandlerMapping implementation (org.springframework.web.servlet.HandlerMapping). The DispatcherServlet consults with one or more HandlerMapping implementations to find out which controller (handler) can handle the request. So, HandlerMapping determines which controller to call.

The HandlerMapping interface provides the abstraction for mapping requests to handlers. The HandlerMapping implementations are capable of inspecting the request and coming up with an appropriate controller. Spring MVC provides ...

Get Spring MVC Beginner’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.