春季休息站?

发布于 2024-10-06 04:57:14 字数 302 浏览 0 评论 0原文

@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")?

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

requestbody will convert the json into bean(pojo), is there required to use annotation @ModelAttribute("user") in this case?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

み格子的夏天 2024-10-13 04:57:14

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

@ModelAttribute is not required in this case. For more information on this subject, please see Keith Donald's blog: Ajax Simplifications in Spring 3.0

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文