There are times where creating controllers for each action is not recommended. In these situations, you should seek out the MultiActionController and a MethodNameResolver implementation that will satisfy your situation. The MultiActionController allows you to have a controller that has multiple request handling methods in it. The associated MethodNameResolver implementation does the heavy lifting, putting the responsibility of resolving the URI to the appropriate method in the MultiActionController implementation squarely in Spring MVC's framework realm.
Spring MVC context file
<bean name="/storefront" class="foobar.web.controllers.StoreFrontController"> <property name="methodNameResolver"> <bean class="org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver"> <property name="paramName" value="method"/> </bean> </property> </bean>
|