波神

导航

Spring MVC之@RequestMapping 传递数组

1、前台:

var param = {titles:['col1','col2','col3']};  
$.ajax({url:url, type:"post", data:param, async:false, dataType:"json", cache:false, error:function (data) {  
        rtnObj = data.responseText;  
    }, beforeSend:function (XMLHttpRequest) {  
        //ajaxStart();  
    }, complete:function (XMLHttpRequest, textStatus) {  
        //ajaxComplete();  
    }, success:function (data) {  
        rtnObj = data;  
    }});  

2、后台:

@RequestMapping(value="/exportExcel", method = RequestMethod.POST)  
    @ResponseBody  
    public String exportExcel(@RequestParam(value = "titles[]") String[] titles){  
        System.out.println(titles);  
        return null;  
    } 

 

posted on 2016-11-14 20:08  波神  阅读(1449)  评论(0编辑  收藏  举报