title: How to bind a Set<CustomObject> in spring mvc form
body: <p>I have a command object associated with a spring form controller:</p>
  
  <pre><code>public class PluginInstance {
    private Set&lt;PluginParameter&gt; pluginParameters = new HashSet&lt;PluginParameter&gt;();
    ... some other string/long properties and getter setters...
  }
  </code></pre>
  
  <p>the PluginParameter also have a Set in it which contain the values</p>
  
  <pre><code>public class PluginParameter {
    private String parmName;
    private Set&lt;PluginParmvalue&gt; pluginParmvalues = new HashSet&lt;PluginParmvalue&gt;();
    ...some other string/long properties and getter setters...
  }
  </code></pre>
  
  <p>(Normally the pluginParmvalues will contain only one value, a list have been used for future expandability)</p>
  
  <p>In the spring form I binding the values as</p>
  
  <pre><code>&lt;form:input path="pluginParameters[${itemsRow.index}].pluginParmvalues[0].parmValue" /&gt;
  </code></pre>
  
  <p>but the thing is that there can be a form:select(to present multiple predefined options to the user) or form:input (user can input any value). This has to be decided from another object</p>
  
  <pre><code>public class PluginConfigParm {
    private String parmName;
    private ArrayList&lt;String&gt; choices;
    ...getter setters and other properties
  }
  </code></pre>
  
  <p>where I have to compare the name of PluginConfigParm.paramName with PluginParameter.paramName when they match and PluginConfigParm.choices.size() > 0 then form:select will be shown populated with the values from PluginConfigParm.choices otherwise form:input will be shown.</p>
  
  <p>The question is simple: How can I do that.
  Any help will be highly appreciated.</p>