SpringBoot 如何从前台传递数组

1.SpringBoot 如何从前台传递数组


 

 

 

2、前台

 

$.ajax({
                    url: 'deleteBsGiftById',
                    type: 'post',
                    dataType: 'json',
                    data: {
                        ids: idArray
                    }
)}

 

 

3、后台接收

  @PostMapping("deleteBsGiftById")
    @ResponseBody
    public boolean deleteBsGiftById(@RequestParam(value = "ids[]") String[] ids) {
        return true;
    }

 

4、@RequestBody 接收数组 前台需要传递Json类型

后台:

@RequestMapping("deleteVillages")
public JSONObject deleteVillages(@RequestBody String[] id){}

前台:

 

posted @ 2019-04-18 14:24  程序猿小码  阅读(17230)  评论(0编辑  收藏  举报