title: Display a value in a javascript dropdown list from an object
body: <p>I have a dropdown list in javascript which is populated based on the 'name' field of an object. Is it possible to put the whole object in the dropdown list and just display the name? The reason im asking is because I want to change the value of another dropdown based on what the user selects, and that information is already available in the first object (before I strip out just the name). </p>
  
  <p>So at the moment I have this (Java controller):</p>
  
  <pre><code> List&lt;String&gt; hostsList = new ArrayList&lt;String&gt;();
  
   for (Client client : adminService.getClients()){
       hostsList.add(client.getName());
   }
  
   result.put("hostsList", hostsList);
  </code></pre>
  
  <p>and then this on the javascript side:</p>
  
  <pre><code>&lt;form:form id="iForm" method="post"
  action="${pageContext.request.contextPath}/host"
  commandName="hostsForm"&gt;
  &lt;td valign="top"&gt;Hosts:&lt;/td&gt;
  &lt;td valign="top"&gt;&lt;form:select path="uSetHostName"&gt;
  &lt;form:option value="NONE" label="--- Select ---" /&gt;
  &lt;form:options items="${hostsList}" /&gt;
  &lt;/form:select&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>So how do I put a whole object into the dropdown and just display its name?</p>
  
  <p>Thanks,</p>