1.@RequestParam
var param = {}; param.keys = delKeys.join();//delKeys是数组,如delKeys=['a',b','c'],join函数把数组拼接成字符串,分隔符默认是, $.ajax({ type: "POST", data: param, dataType: "json",//预期服务器返回的数据类型 url: ctxpath+"/cache/deleteCache.action", success: function (serverData) { alertWin("成功删除"+serverData.data+"条"); search(); } });
@RequestMapping("/deleteCache.action")
@ResponseBody
private PageResponse deleteCache(HttpServletRequest request,@RequestParam List<String> keys) {
//keys可以得到正确的数组
//request.getParameter("keys") 得到的是"a,b,c"
}