SpringMVC接收参数的注解笔记

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"
}

 

 


posted @ 2015-12-15 23:52  幽灵漫步  阅读(224)  评论(0编辑  收藏  举报