用Spring MVC 接收表单多对象的时候用@InitBinder
@Controller public class HelloController extends BaseController{ @InitBinder("teacher") public void initBinder1(WebDataBinder binder){ binder.setFieldDefaultPrefix("teacher."); } @InitBinder("student") public void initBinder2(WebDataBinder binder){ binder.setFieldDefaultPrefix("student."); } //URL映射 @RequestMapping(value="/save", method = RequestMethod.POST) public ModelAndView save(Teacher teacher,Student student) { System.out.println(teacher.getName()+" "+student.getName()); return null; }