SpringMVC怎么获取前台传来的数组

2024-11-29 00:57:33
推荐回答(1个)
回答1:

var tollerlist = new Array();
for(var k in objToller){
tollerlist.push(k);
}
$.ajax({
type:"post",
url:"${rc.contextPath}/inspection/set-toller-task.json",
dataType:"json",
data:{workareaId:workareaId,tollerlist:tollerlist},
success:function(data){

}
});

@RequestMapping(value = "/set-toller-task")
public void setTollerTask(ModelMap model, @RequestParam("workareaId") int workareaId,
@RequestParam("tollerlist[]") List tollerlist) {

model.addAttribute(JSON_STATUS, JSON_STATUS_OK);
}