springMVC怎么获取从jsp传过来的集合相似List

J2EE 码拜 8年前 (2016-03-16) 1303次浏览
springMVC怎么获取从jsp传过来的集合相似List<User>
jsp页面从后台循环读出了几条数据。这几条数据存在HTML的input标签中。故点击from表单的提交时候
应该将这个List<User>  要传到后台修改。
本人使用这样无法传入
@requestMapping(“/test”)
public String getTest(List<User> users){
return “test”;
}
希望谁能给个解决办法。或说springMVC不能使用List<Bean>作为参数。请指点。
解决方案

20

另外写一个辅助如MySpringMVCConvertUtil,然后在这个里写个List<user>的属性并初始化,controller中这样写
@requestMapping(“/test”)
public String getTest(MySpringMVCConvertUtil util){
util.getUserList();//这个里面就会有你要的list
return “test”;
}

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明springMVC怎么获取从jsp传过来的集合相似List
喜欢 (0)
[1034331897@qq.com]
分享 (0)