SpringMvc 能够接收将前端传递的数组,可使用转换为List<T>或者数组接收前端
前端作法:java
$.ajax({ type:'post', url :'test', data:{ name : 'nick', kind : [20,30,40] } })
后端接收:ajax
<!-- lang: java --> @RequestMapping("test") public void test(String name, @RequestParam(value = "kind[]", defaultValue = "") List<Integer> kind, HttpServletRequest request, Writer writer) { }