SPRINGMVC handlemapping Processor Mapper Property list

Source: Internet
Author: User

List of properties for mapper

DEFAULTHANDLER Specifies the default processor (the processor is the Controller (action) class that you define) in cases where the mapping does not match all processors

Order Spring sorts the mapper based on the value of the order and uses the first matching processor, the smaller the order value, the higher the priority (equivalent to the index position of the chain, starting at 0, and level 0 highest)

List of interceptors used by interceptors

Alwaysusefullpath whether to use full path matching processor in servlet context, default false

UrlDecode default False, set this property to True if you want the mapper to decode the Url/uri before looking for the processor.

Lazyinithandlers default False, a singleton processor can be deferred initialization

Urlpathhelper can check URLs with this property, typically without modifying their default values

SPINGMVC has a lot of mappers, but there are three kinds of beannameurlhandlermapping (default mapper), Simpleurlhandlermapping, Controllerclassnamehandlermapping

Description: <url-pattern>*.action</url-pattern> is used in my web. xml


As the name implies, it is mapped when the bean's Name property is accessed as a URL, so what does this bean refer to? Of course, the Controller (action) of our developer's own definition

I'm using Usercontroller here.

Address bar:

See below for specific configuration files


This mapper is typically used to handle multiple requests for a controller (action), and of course can be used as an alias to replace the Mapper. See below for specific configuration files


Use the Controller's class name (first letter lowercase). Map when action is accessed

The use of this mapper is to note that your controller class name must be Xxxcontroller, not xxxaction this , otherwise you will not find

Of course, you can add a DefaultHandler property to it, specify a default processor (that is, the controller class you define), but there is no need to use this mapper.

4. Configuration files

1  <!--use beannameurlhandlermapping to complete multiple requests for one action -2       <Beanname= "/add.action,/delete.action,/update.action,/find.action"class= "Cn.tele.springmvc_003.UserAction"></Bean>3         4       <!--the id attribute is given when the action is registered -5       <BeanID= "Useraction"name= "/usercontroller.action"class= "Cn.tele.springmvc_003.UserController"></Bean>6      7       <!--Mapper (default) -8       <Beanclass= "Org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"></Bean>9      Ten       <!--use simpleurlhandlermapping to complete multiple requests for one action - One       <!--<bean class= "org.springframework.web.servlet.handler.SimpleUrlHandlerMapping" > A <property name= "Mappings" > - <props> - <prop key= "/add.action" >userAction</prop> the <prop key= "/delete.action" >userAction</prop> - <prop key= "/update.action" >userAction</prop> - <prop key= "/find.action" >userAction</prop> - </props> + </property> - </bean> - +      A     <!--accessed in the form of class name. Action, Usercontroller.action class first letter lowercase - at     <!--<bean class= "org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping" > - <property name= "DefaultHandler" ref= "useraction" ></property> - </bean> -

It's worth mentioning that these mappers can coexist, but only one mapper at a time works, and which mapper depends on how you access and the mapper's order value, and how many different mappers make up a

Chain, the lower the order value, the higher the priority, and when the higher priority mapper fails to process, it will be given a low-priority processing that cannot be matched to the processor (that is, the controller you define).

SPRINGMVC handlemapping Processor Mapper Property list

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.