HandlerMapping is responsible for translating a URL pattern to a controller. There are several URL mappers:
BeanNameUrlHandlerMapping
: Maps a URL to a bean based on the name of the controller's bean, as defined in the bean's XML definition.SimpleUrlHandlerMapping
: Maps a URL to a bean based on a list of properties. (In Listing 2, theSimpleUrlHandlerMapping
class is used to map/home.htm
to the bean with the ID ofhomePageController
.)ControllerClassNameHandlerMapping
: Maps a URL to a bean based on the bean's class name. For example,HomePageController
would be mapped to/homePage*
, such as/home.htm
.ControllerBeanNameHandlerMapping
: Similar to theBeanNameUrlHandlerMapping
mapper, but does not expect bean names to follow the URL convention. Also supportsController
annotations.CommonsPathMapHandlerMapping
: Maps URLs to a controller based on Jakarta Commons Attributes metadata.DefaultAnnotationHandlerMapping
: Maps URLs to a controller for methods that implement theRequestMapping
annotation.
No comments:
Post a Comment