I have an array of checkbox which are rendered on the JSP. Checkbox works just fine but when i post the JSP on controller i am not getting just those checkbox which are clicked but all along with bind path variable which is always false, while it should be true if checked. Due to this i am not able to figure out which box were checked and which were unchecked on the page. Here is my JSP -
Page model attribute is mainVO which contains sizeVO list. SizeVo has properties like id, name, price ect. In controller if i print i am getting followingCode:<c:forEach var="sizeVo" items="${menuVO.sizeList}" varStatus="item"> <tr class="${item.index % 2 == 0 ? 'odd gradeX' : 'even gradeC'}"> <td><form:hidden path="sizeList[${item.index}].sizeId" id="sizeId" value="${sizeVo.sizeId}"/> <form:checkbox path="sizeList[${item.index}].isChecked" id="sizeSelect" value="on"></form:checkbox> </td> <td> <c:out value="${sizeVo.sizeName}"/> </td> <td> <c:out value="${sizeVo.sizeDesc}"/> </td> <td><form:input path="sizeList[${item.index}].sizePrice" id="sizePrice" size="20" class="validate[required] small"/></td> </tr> </c:forEach>
I want only those checkboxes to bind which are checked, not all of them.Code:SizeVO Object {Id: 3, Name: Big, Description: desc - 6, Price: 50, isChecked: false}, SizeVO Object {Id: 4, Name: Half , Description: desc - 2, Price: 10, isChecked: false}


Reply With Quote