Content about Java ERP Solution for Reviews Best ERP Software for sale and Free Software with Java OpenSource for Free Download

Spring Framework How to use multiaction controller with binding method name

You can use mvc class  : org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver
to bind url to method in MVC Class for example in below

    CONTROLLER DEFINITIONS

  <bean id="welcomeController" class="com.spring.controller.WelcomeController">  
     <property name="methodNameResolver" ref="welcomeControllerResolver"/>  
   </bean>    
   <bean id="welcomeControllerResolver"  
     class="org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver">  
     <property name="mappings">  
       <props>  
         <prop key="/welcome1.cdr">loadWelcome1</prop>  
         <prop key="/welcome2.cdr">loadWelcome2</prop>  
        </props>  
     </property>  
   </bean>  

** loadWelcome1 and loadWelcome2 is method name in Controller class WelcomeController

  URL MAPPING

 <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">  
     <property name="mappings">  
       <props>        
         <prop key="/welcome1.cdr">welcomeController</prop>  
         <prop key="/welcome2.cdr">welcomeController</prop>  
       </props>  
     </property>  
   </bean>  

each url can binding to the same controller it's will be defind method mapping in ControllerResolver