SpringMVC传参
- @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);
- }
- }
原文地址:https://www.cnblogs.com/lovebaoqiang/p/4172102.html