简体   繁体   English

嵌套列表中的属性发布在 spring mvc 中似乎不起作用

[英]Post of properties in a nested list does not seem to work in spring mvc

I have an Object with a main list in it and a sub list in that main list.我有一个对象,其中有一个主列表和一个主列表中的子列表。 Showing the properties in a form is no problem.在表单中显示属性没有问题。
But when I post the form and one or more of the properties of the sub list are inputs (hidden or not) I get the following:但是当我发布表单并且子列表的一个或多个属性是输入(隐藏或不隐藏)时,我得到以下信息:

InvalidPropertyException: Invalid property 'groups[0].members[0]' of bean class [xxx.MyModelObject]: Index of out of bounds in property path 'members[0]'; nested exception is java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

I use a Freemarker (2.3.22) view.我使用 Freemarker (2.3.22) 视图。 The generated html of one sub list property is:一个子列表属性生成的 html 是:

<input type="hidden" id="groups0.members0.surName" name="groups[0].members[0].surName" value="dummyName">

Seems Ok to me.对我来说似乎还可以。 There is no problem with simple properties in the main list, like id groups0.groupName / name groups[0].groupName.主列表中的简单属性没有问题,例如id groups0.groupName / name groups[0].groupName。
(spring version 4.1.3). (春季版本 4.1.3)。

检查组和成员类的 getter 和 setter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM