SpringBoot RequestBody ajax提交对象

前端实现:

var student = {
    "name":1,
    "age":2,
    "score":3
};
$.ajax({                                
    url:"student/test/delStudentByPrimaryKey.action",
    contentType:"application/json;charset=UTF-8",
    type:'POST',
    dataType:'json',//json 返回值类型
    data: JSON.stringify(student),//转化为json字符串
    success:function(data){
    }
});

后端实现:

@RequestMapping(value = "/delStudentByPrimaryKey")
void deleteByPrimaryKey(@RequestBody Student student){
        System.out.println(student);
}
原文地址:https://www.cnblogs.com/chenzheng8975/p/9662959.html