Announcement Announcement Module
No announcement yet.
form:Checkbox issues Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • form:Checkbox issues

    Hi all,

    I have been trying to make the form:checkbox working and I am halfway to success . I am using spring MVC 2.5 and I managed to display correctly the checkboxes in the JSP but it seems that they are NOT causing any effects on my collection back in the controller.

    I have this collection of objects in the class RoomGroup
    private Set<RoomFacilityItem> facilities = new HashSet<RoomFacilityItem>();
    and the class RoomFacilityItem overrides the toString()
       public String toString() {
          return String.valueOf(ID);
    in the JSP page I have:
    <form:checkbox id="roomGroup_${roomGroup.key}_check_${roomFacilities[k].ID}"
                value="${roomFacilities[k].ID}" />
    And all is appearing fine in the JSP. If there are some facilities assigned to a roomGroup, the checkboxes are correctly appearing selected in the HTML page.

    When I submit the page, it seems that I do not have any effect in the RoomGroup.facilities. Whatever was there before is still there. I cannot add/remove anything using the checkboxes on the page.

    Since the RoomFacilityItem objects needs to be retrieved from the DB [I have already a service for this] it seems that I am missing a piece in the puzzle. I can understand that the ID are retrieved from the list by accessing the getID() method. But the opposite part is blurry to me.

  • #2
    updated: fixed by using an binder.registerCustomEditor and a PropertyEditorSupport.