如何在SpringMVC + Thymeleaf中将HTML数组绑定到arrayList

时间:2018-07-09 18:07:36

标签: java spring spring-mvc thymeleaf

我有和对象的字段是ArrayList:

@Expose
private Collection<CallFeatureAni> anis;

在表单中,我可以毫无问题地绘制值:

enter image description here

在HTML中,值用[]命名以表示数组:

<tr><td>
    <input name="callFeature.anis[].id" value="1" type="hidden">
    <input class="form-control" value="01152692150"     name="callFeature.anis[].ani" type="text">
....

但是当我执行Submit命令时,出现以下错误:

org.springframework.beans.InvalidPropertyException: Invalid property 'anis[]' of bean class [beans.CallFeature]: Invalid index in property path 'anis[]'; nested exception is java.lang.NumberFormatException: For input string: "" 

0 个答案:

没有答案