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){}

前台:

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM