I struggle against this bug since days. I tried every methods i've found on internet but it seems that i'm the only one to have this problem.
I've got java classes like this :
Class ListItem{
private int id;
}
Class ListContainer{
private List<ListItem> items;
}
And a jsp like this :
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
...
<form:form method="post" action="myController" modelAttribute="listContainerModel">
<c:forEach items="${listContainerModel.items}" var="currentItem" varStatus="i">
<form:input type="text" path="items[${i.index}].id" name="id"/>
</c:forEach>
</form:form>
But i've got this exception
org.springframework.beans.InvalidPropertyException: Invalid property 'items[${i.index}]' of bean class [foo.bar.ListContainer]:
Invalid index in property path 'items[${i.index}]'; nested exception is java.lang.NumberFormatException: For input string: "${i.index}"
I've tried many things such as
How to send list of Objects to View and back to Post method in controller post-method-in-controller
or http://viralpatel.net/blogs/spring-mvc-multi-row-submit-java-list/
I suppose i've a problem mixing jstl tags + el expression + spring mvc taglibs but i can't figure out why.