title: Spring MVC 3 - custom labels in <form:select>
body: <p>I'm creating a form in which user will be able to choose (among the others) the factory of a product.</p>
  
  <p>Each factory is identified by and ID and has specific address.</p>
  
  <p>I want to use custom label in following code:</p>
  
  <pre><code>&lt;form:select items="${factories}" path="factory" itemValue="id" itemLabel="..."/&gt;
  </code></pre>
  
  <p>At first i tried using Spring Formatter functionality (org.springframework.format.Formatter interface), but when I did this, and when I removed "itemLabel" attribute to have it displayed automatically via Formatter):</p>
  
  <pre><code>&lt;form:select items="${factories}" path="factory" itemValue="id"/&gt;
  </code></pre>
  
  <p>But then It wasn't selecting proper value if it was set (in case of editing).</p>
  
  <p>Then I tried to:</p>
  
  <pre><code>&lt;form:select path="factory" itemValue="id"&gt;
      &lt;c:forEach ...&gt;
           &lt;form:option value="${factory.id}" label="${factory.address.city} ${factory.address.street}"
      &lt;/c:foreach&gt;
  &lt;/form:select&gt;
  </code></pre>
  
  <p>But as in earlier solution spring was not selecting proper value that was set in model.</p>
  
  <p>My question is:</p>
  
  <p>Is it possible to format entity in a way, that form:select works properly, when a value of select field is not the same as its label.</p>