开发者

spring rest post?

开发者 https://www.devze.com 2023-01-28 03:43 出处:网络
@ModelAttribute(\"user\") @RequestMapping(value = \"/\", method = RequestMethod.POST) public User saveUser( @RequestBody User user ) throws IOException {
@ModelAttribute("user")
@RequestMapping(value = "/", method = RequestMethod.POST)
public User saveUser( @RequestBody User user ) throws IOException {
        logger.debug(user);
        return user;
开发者_JAVA技巧}

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


@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

0

精彩评论

暂无评论...
验证码 换一张
取 消