Multiactioncontroller Default method Name resolver
is to include the specified method name in the requested address
The Multiactioncontroller class has a property Methodnameresolver, method name resolver: It has a default value Internalpathmethodnameresolver, The parser parses the method name as a resource name, which means that when we submit the request, the method name appears as a resource name.
Method Name resolver: Propertiesmethodnameresolver is <bean id= "Mymulticontroller" class= " Cn.kitty.controller.MyMultiController "> Properties.
Default method Name: Multiactioncontroller<?xml version= "1.0" encoding= "UTF-8"? ><beans xmlns= "/http Www.springframework.org/schema/beans "xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "xmlns:mvc="/HTTP/ Www.springframework.org/schema/mvc "xsi:schemalocation=" Http://www.springframework.org/schema/beans http://ww W.springframework.org/schema/beans/spring-beans.xsd HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/MVC/HTTP Www.springframework.org/schema/mvc/spring-mvc.xsd "> <bean class=" Org.springframework.web.servlet.handler.SimpleUrlHandlerMapping "> <property name=" UrlMap "> & lt;map> <entry key= "/*.do" value= "Mymulticontroller" ></entry> </map> < /property> </bean> <bean class= "Org.springframework.web.servlet.view.InternalResourceViewResolver" > <!--prefixes prefix---<property name= "prefix" value= "/" ></property> <!--suffix suffix---≪property name= "suffix" value= ". JSP" ></property></bean><!--Registration Method name Resolver--><bean id= " Propertiesmethodnameresolver"class=" Org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver "> <property name=" Mappings "> <props> <prop key="/first.do ">doFirst</prop> <prop key="/s Econd.do ">doSecond</prop> </props> </property></bean><!--Register Controller default method name Multiactioncontroller--><bean id= "Mymulticontroller" class= "Cn.kitty.controller.MyMultiController" > <property name= " Methodnameresolver "ref="Propertiesmethodnameresolver"></property></bean></beans>
Xml
<! DOCTYPE Web-app Public "-//sun Microsystems, INC.//DTD Web Application 2.3//en" "Http://java.sun.com/dtd/web-app_2_3. DTD "><web-app> <display-name>archetype Created Web application</display-name> <servlet> & Lt;servlet-name>springmvc</servlet-name> <servlet-class>org.springframework.web.servlet.Dispatcherservlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <para M-value>classpath:Springmvc.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <ser Vlet-mapping> <servlet-name>springmvc</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>default</ Servlet-name> <url-pattern>*.jpg</url-pattern> </servlet-mapping></web-app>
Springmvc Multiactioncontroller Default method name resolver