Book Image

Spring MVC Beginner's Guide

By : Amuthan Ganeshan
Book Image

Spring MVC Beginner's Guide

By: Amuthan Ganeshan

Overview of this book

Table of Contents (19 chapters)
Spring MVC Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 many HandlerMapping implementations, and the one we are using to detect and interpret mappings from the @RequestMapping annotation is the RequestMappingHandlerMapping class (org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping...