I have a collection of values, which I'd like the user to select some subset of. How can I show a list of checkboxes and bind the values of those checkboxes into some sort of collection which represents the user's selection?
I know how to bind checkboxes to single bean properties. In this case, I'll need to bind to some sort of collection (any will do).
Does spring support binding checkbox values to maps (in the same way as binding to beans)? I'm thinking something like:
Code:<c:forEach var="${category}" items="${categories}"> <spring:bind path="form.selectedCategories[${category}]"> <input type="hidden" name="_${status.expression}" /> <input type="checkbox" value="true" name="${status.expression}" <c:if test="${status.value}">checked="checked"</c:if> > ${category} </spring:bind> </c:forEach>


Reply With Quote