SpringMVC怎么获取前台传来的数组
1个回答
2017-04-21 · 知道合伙人软件行家
关注
展开全部
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){
<!--后面的就不说了,可以看到这个tollerlist 是一个数组-->
}
});
@RequestMapping(value = "/set-toller-task")
public void setTollerTask(ModelMap model, @RequestParam("workareaId") int workareaId,
@RequestParam("tollerlist[]") List<Integer> tollerlist) {
model.addAttribute(JSON_STATUS, JSON_STATUS_OK);
}
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){
<!--后面的就不说了,可以看到这个tollerlist 是一个数组-->
}
});
@RequestMapping(value = "/set-toller-task")
public void setTollerTask(ModelMap model, @RequestParam("workareaId") int workareaId,
@RequestParam("tollerlist[]") List<Integer> tollerlist) {
model.addAttribute(JSON_STATUS, JSON_STATUS_OK);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询