title: Spring MVC form:options tag not wiring into my objects Id?
body: <p>I am trying to display my command objects collection field inside a list box. Inside said collection is a field, id and name. I want use the id as the html option value and the name as the option text. See the code below;</p>
  
  <pre><code>&lt;form:select id="customCollection" path="customCollection" size="10"&gt;
      &lt;form:options items="${command.customCollection}" itemValue="id" itemLabel="name"/&gt;
  &lt;/form:select&gt;
  </code></pre>
  
  <p>Name prints out fine, but value is left blank. Here is the output HTML;</p>
  
  <pre><code>&lt;option selected="selected" value=""&gt;name-value&lt;/option&gt;
  </code></pre>
  
  <p><br>
  My initial assumption was that my data was incorrect, but after putting the following code in my page;</p>
  
  <pre><code>&lt;c:forEach items="${command.customCollection}" var="c"&gt;
      ${c.id} : ${c.name} &lt;br&gt;
  &lt;/c:forEach&gt;
  </code></pre>
  
  <p>both the id and the name are correctly printed out. So my data is correctly being delivering to my view. Which makes me assume I am either using form:options incorrectly or hitting some bug in form:options.</p>
  
  <p>Can anyone help me out here?</p>
  
  <p><strong>EDIT:</strong><br>
  Thanks to the help of BacMan and delfuego, I've been able to narrow down this issue to my binder.</p>
  
  <p>Previously I was assigning the value in my element to the name of the row, here is my initial binder;</p>
  
  <pre><code>binder.registerCustomEditor(Collection.class, "customCollection",
          new CustomCollectionEditor(Collection.class) {
  
      @Override
      protected Object convertElement(Object element) {
          String name = null;
  
          if (element instanceof String) {
              name = (String) element;
          }
          return name != null ? dao.findCustomByName(name) : null;
      }
  });
  </code></pre>
  
  <p>When I remove this code from my initBinder method the row value is correctly inserted into the form, but I need a customEditor to convert said value into a database object.</p>
  
  <p>So this is my new attempt at a binder;</p>
  
  <pre><code>binder.registerCustomEditor(Collection.class, "customCollection",
          new CustomCollectionEditor(Collection.class) {
  
      @Override
      protected Object convertElement(Object element) {
          Integer id = null;
  
          if (element instanceof Integer) {
              id = (Integer) element;
          }
          return id != null ? dao.find(Custom.class, id) : null;
      }
  });
  </code></pre>
  
  <p>However this is causing the same behavior as the previous binder and making the value not show up. Any ideas about what I am doing wrong here?</p>
  
  <p><strong>EDIT 2:</strong><br>
  As I mentioned above, if I comment out my custom binder then the Custom object does load its id and name correctly for the view portion of the form, but then never binds back into the parent object when I attempt to save it. So I really think the issue is with my binder. </p>
  
  <p>I've placed debugging statements inside my convertElement method. Everything looks like it should be worked, the dao is correctly pulling objects from the database. <strong>The only behavior that strikes me as suspect is that the convertElement method is called twice for each Custom item.</strong></p>