Hi,
I have two controllers , a simple form controller and a multiaction controller.
Now, in simpleformcontroller, i want to redirect a request to multiaction controller.
Here's code snippet in simpleformcontroller
another.htm binds to a method in multiaction controller.Code:protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) { MyObject myOb = (MyObject )command; system.out.println(myOb.toString); ModelAndView mav = new ModelAndView(new RedirectView("another.htm")); mav.addObject("Obj",myOb); return mav; }
and the code in multiactioncontroller isCode:<bean id="MyController" class="MyController"> <property name="methodNameResolver"> <bean class="org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver"> <property name="mappings"> <props> <prop key="/another.htm">another</prop> </props> </property> </bean> </bean>
The output is, all fields of Myobj are nulls in mutiactioncontroller whereas they have valid values when passed in simpleformcontroller.Code:public class MyController extends MultiActionController { public ModelAndView another(HttpServletRequest request, HttpServletResponse response, MyObject myObj) throws CRPMException { system.out.println(myObj.toString()); } }
Am i missing something here or is this not the right way to pass command objects ?
Any help is appreciated.


Reply With Quote
