Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I am trying to do spring form binding to a collection of objects from which a user will select one item using a radio button.
- So i have this below:
- <c:forEach var="timeSlot" items="${appointment.availableTimes}" varStatus="varStatus">
- <tr>
- <td>
- <spring:bind path="appointment.availableTimes[${varStatus.index}].selected">
- <input type="radio" name="timeSlot" <c:if test="${timeSlot.selected == true}">checked</c:if> />
- </spring:bind>
- </td>
- </tr>
- </c:forEach>
- On form submission, all the above time slots have a value of false regardless of the user selection.
- The selection is persisted to the server only if i change the name attribute to: name="${status.expression}"
- But in that case, they no longer behave as a radio button group because then one can select more than one item yet i want them select only one.
Advertisement
Add Comment
Please, Sign In to add comment