我有一个bean AgreegateBean,我正在使用它作为传输对象。豆的类定义为 -春季索引超出限制MVC
Class AgreegateBean {
private SomeOtherBean bean;
private List<Person> someList;
// getters and setters
}
我在使用ModelAttribute注释的Spring控制器中使用此bean。对于JSP,我有JSTL。我用这样的字段填充了JSP。
<input type="text" name="someList[0].name" />
<input type="text" name="someList[0].surName" />
当我提出我的形式我得到java.lang.IndexOutOfBoundsException:指数:0,大小:0。
org.springframework.beans.InvalidPropertyException: Invalid property 'someList[0]' of bean class [com.form.bean.AgreegateBean]: Index of out of bounds in property path 'someList[0]'; nested exception is java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
我不认为这是问题,因为OP提到“提交”表单。我认为这更多Spring并没有创建'Person'的新实例。 – Tunaki