SpringMVC接受复杂json数据类型

来源:互联网 发布:网络流行的词 编辑:程序博客网 时间:2024/06/05 06:09
public Result<String> imgsAdd(@RequestBody List<Img> imgs) throws ImgException {Result<String> result = new Result<String>();if(imgService.insertByBatch(imgs) > 0) {//redirect list pagereturn result.success();} else {//throws exceptionthrow new ImgException("add imgs exception");}}


这个是SpringMVC的一个控制方法。

ajax传递json数据类型就是:

json:[

    {id:id, name:name,......},

    {id:id, name:name,......}

]


其中id,name是model img对象的属性,小问题记录,哈哈·····

0 0
原创粉丝点击