Springmvc Multiactioncontroller Default method name resolver

Source: Internet
Author: User

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---&Lt;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

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.