java 接收json数据
2021-05-02 16:27
标签:int out color app body net code 声明 style java 接收json数据 标签:int out color app body net code 声明 style 原文地址:https://www.cnblogs.com/lovetl/p/13202684.html1、以实体类方式接收
@Controller
@RequestMapping("/user")
public class UserAction {
@RequestMapping(value = "/add")
@ResponseBody
public String add(@RequestBody User u) {
System.out.println(u+">>>>>");
return "success";
}
}
2、以Map接收
@Controller
@RequestMapping("/user")
public class UserAction {
@RequestMapping(value = "/add")
@ResponseBody
public String updateAttr(@RequestBody Map