厦门建设局网站改到哪,网络公司经营范围可以加技术培训,网络营销平台策略,抖音优化是什么意思方式一
前端以字符串形式传递idList#xff0c;采用逗号拼接#xff0c;后端直接使用list接收
// 前端代码
form: {otherParam: ,idList: [id1,id2].join(,)
}//后端代码
// 在后端接收idList时#xff0c;直接使用ListT 就可以接收前端字符串#xff08;默认使用…方式一
前端以字符串形式传递idList采用逗号拼接后端直接使用list接收
// 前端代码
form: {otherParam: ,idList: [id1,id2].join(,)
}//后端代码
// 在后端接收idList时直接使用ListT 就可以接收前端字符串默认使用英文逗号,做自动切分
RequestMapping(value /updateXX)
public void updateXX(RequestParam(otherParam) String otherParam, RequestParam(value idList) ListString idList) {}方式二
前端以数组形式传递后端使用RequestParam(value idList[]) ListString idList方式接收
// 前端代码
form: {otherParam: ,idList: [id1,id2]
}//后端代码
RequestMapping(value /updateXX)
public void updateXX(RequestParam(otherParam) String otherParam, RequestParam(value idList) ListString idList) {}方式三
前端以JSON数组形式传递后端使用RequestBody ListString idList接收
// 前端代码以json数组传递数值
const idList [13,22]
return axios({url: url,method: post,data: idList,headers: {Content-Type: application/json}})//后端代码
// 使用RequestBody方式接收
PostMapping(/updateXX)
public void updateXX(RequestBody ListString idList) {
}参考https://blog.csdn.net/u012294724/article/details/117734941