1
@ModelAttribute("user")
@RequestMapping(value = "/", method = RequestMethod.POST)
public User saveUser( @RequestBody User user ) throws IOException {
        logger.debug(user);
        return user;
}

requestbody 会将 json 转换为 bean(pojo),在这种情况下是否需要使用注解 @ModelAttribute("user")?

4

1 回答 1

1

在这种情况下,@ModelAttribute 不是必需的。有关此主题的更多信息,请参阅 Keith Donald 的博客:Ajax Simplifications in Spring 3.0

于 2010-12-04T16:35:58.650 回答