another day, another way :lol:
I fixed my problem :!:
I created an object that 'holds' my object (item) and has an isSelected flag.
Next, I had the problem that unchecked checkboxes are not submitted by HTML. To solve this I found a thread and a good comment from user yatesco
WebDataBinder sets all propertys to empty for which there is a parameter called "_[propertyName]".
This works for all properties, not just checkboxes
So here is my JSP code:
Code:
<c:forEach var="type" items="${order.test}" varStatus="s">
<tr>
<td>
<spring:bind path="order.test[${s.index}].selected">
<input type="checkbox" name="${status.expression}" value="true" <c:if test="${status.value}">checked="checked"</c:if> />
<input type="hidden" name="_<c:out value="${status.expression}"/>">
</spring:bind>
</td>
<td><c:out value="${type.item.text}"/> (<c:out value="${type.item.code}"/>)</td>
</tr>
</c:forEach>
If you have better ideas, let me know.
Thanks in advance, Leif