Guest User

Untitled

a guest
Dec 10th, 2012
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. 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.
  2.  
  3. So i have this below:
  4.  
  5. <c:forEach var="timeSlot" items="${appointment.availableTimes}" varStatus="varStatus">
  6. <tr>
  7. <td>
  8. <spring:bind path="appointment.availableTimes[${varStatus.index}].selected">
  9. <input type="radio" name="timeSlot" <c:if test="${timeSlot.selected == true}">checked</c:if> />
  10. </spring:bind>
  11. </td>
  12. </tr>
  13. </c:forEach>
  14.  
  15.  
  16. On form submission, all the above time slots have a value of false regardless of the user selection.
  17. The selection is persisted to the server only if i change the name attribute to: name="${status.expression}"
  18. 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