SpringMVC Get请求传集合,前端"异步"下载excel 附SpringMVC 后台接受集合

时间:2023-03-08 22:00:44

最近项目上管理后台需要自己做一部分js部分,之前都是前端来弄。。。碰到了下载excel,刚开始使用ajax,搞了好久发现不合适。。下载不了,网上说ajax返回类型不支持二进制流。。
因此采用 window.open(url)直接下载,
后台接收
SpringMVC Get请求传集合,前端"异步"下载excel     附SpringMVC 后台接受集合
前台拼接
SpringMVC Get请求传集合,前端"异步"下载excel     附SpringMVC 后台接受集合

Post 接受数组 除了 content type 是application/json 使用@RequestBody 注入之外,
content type 是application/x-www-form-urlencoded 则可以使用 @RequestParam(value = "customerId[]") 一定需要指定value
SpringMVC Get请求传集合,前端"异步"下载excel     附SpringMVC 后台接受集合