You should be able to populate to more than one bean. Simply specify all the beans you want to populate as fields in your form backing object. Then, you can bind to them. It would be something like this:
Code:
public class MyFormBackingObject{
private final MyBean1 beanOne = new MyBean1();
private final MyBean2 beanTwo = new MyBean2();
//getter methods would follow
}
then, in your SimpleFormController
Code:
...
protected Object formBackingObject(HttpServletRequest request) throws Exception {
return new MyFormBackingObject();
}
...
protected ModelAndView onSubmit(
HttpServletRequest request, HttpServletResponse response, Object command, BindException errors)
throws Exception {
MyFormBackingObject myForm = (MyFormBackingObject) command;
MyBean1 beanOne = myForm.getBeanOne();
MyBean2 beanTwo = myForm.getBeanTwo();
//now do anything you need to do with them.
}
Just in case you aren't aware of it, you may wish to populate these beans over more than one page (page 1 sets first bean, page 2 sets second bean), using org.springframework.web.servlet.mvc.AbstractWizard FormController. You can easily populate multiple beans from a SimpleFormController, but if there is a lot of data in the beans, it might make sense to space it out over more than one page.