title: How to make spring checkboxes checked by default?
body: <p>I'm using Spring 3.1.0.RELEASE. I have this field in my command object ...</p>
  
  <pre><code>public Set&lt;EventFeed&gt; getUserEventFeeds() {
      return this.userEventFeeds;
  }
  </code></pre>
  
  <p>On my Spring JSP page, I want to display a checkbox list of all possible event feeds, and then have checked checkboxes if the user has one in his set.  I want to have some special HTML formatting around each checkbox, so I'm trying ...</p>
  
  <pre><code>&lt;form:form method="Post" action="eventfeeds.jsp" commandName="user"&gt;
      ...
          &lt;c:forEach var="eventFeed" items="${eventFeeds}"&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;form:checkbox path="userEventFeeds" value="${eventFeed}"/&gt;&lt;/td&gt;
              &lt;td&gt;${eventFeed.title}&lt;/td&gt;
          &lt;/tr&gt;
          &lt;/c:forEach&gt;
      ...
  </code></pre>
  
  <p>However, the items aren't getting checked by default if one is in the set.  How do I do this?  Here is the binder I'm using in my controller class ...</p>
  
  <pre><code>@InitBinder
  public void initBinder(WebDataBinder binder) {
      binder.registerCustomEditor(EventFeed.class, new EventFeedEditor());
  }
  
  private class EventFeedEditor extends PropertyEditorSupport {
      @Override
      public void setAsText(String text) throws IllegalArgumentException {
          setValue(eventFeedsDao.findById(Integer.valueOf(text)));
      }
  
      @Override
      public String getAsText() {
          return ((EventFeed) getValue()).getId().toString();
      }
  }
  </code></pre>