springmvc 参数@RequestBody用例方法

前端代码

 $.ajax({
     type: "post",
     url: baseUrl + "handleSubmit",
     data: JSON.stringify(self.search),
     contentType: 'application/json',
     dataType: "json",
     success: function (data) {
          console.log(data)
     },
     error: function (error) {
         console.log('request failed', error);
     }
 });

Java后端代码

 @PostMapping(value = "handleSubmit")
 public Map handleSubmit(@RequestBody Entity entity) {
     Map m = new HashMap();
     m.put("entity",entity);
     return m;
 }

おすすめ

転載: blog.csdn.net/ding43930053/article/details/105994888