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
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;
}
another.htm binds to a method in multiaction controller.
<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>
and the code in multiactioncontroller is
public class MyController extends MultiActionController {
public ModelAndView another(HttpServletRequest request,
HttpServletResponse response, MyObject myObj) {
system.out.println(myObj.toString());
}
}
The output is, all fields of Myobj are nulls in mutiactioncontroller whereas they have valid values when passed in simpleformcontroller.
Am i missing something here or is this not the right way to pass command objects ?
Any help is appreciated.