public Result<String> imgsAdd(@RequestBody List<Img> imgs) throws ImgException {
Result<String> result = new Result<String>();
if(imgService.insertByBatch(imgs) > 0) {
//redirect list page
return result.success();
} else {
//throws exception
throw new ImgException("add imgs exception");
}
}
这个是SpringMVC的一个控制方法。
ajax传递json数据类型就是:
json:[
{id:id, name:name,......},
{id:id, name:name,......}
]
其中id,name是model img对象的属性,小问题记录,哈哈·····