- @Controller
- @RequestMapping("/user")
- public UserController extends BaseController{
- @InitBinder("manager")
- public void initBinder1(WebDataBinder binder) {
- binder.setFieldDefaultPrefix("manager.");
- }
- @InitBinder("user")
- public void initBinder2(WebDataBinder binder) {
- binder.setFieldDefaultPrefix("user.");
- }
- @RequestMapping("/addUser")
- public void testBinderOuput(@ModelAttribute User user, HttpServletRequest request, HttpServletResponse response){
- System.out.println(user.getName);
- }
- @RequestMapping("/addManager")
- public void testBinderOuput(@ModelAttribute Manager manager, HttpServletRequest request, HttpServletResponse response){
- System.out.println(manager.getName);
- }
- }
时间: 2024-10-11 10:36:03