This is a very subtle issue that relates ultimately to the way that form data is marshalled into strings by the browser.
If you have form data whose path indicates that the value is part of a collection, it will be handled as you expect in your post. Example:
Code:
<spring:bind path="command.mycollection[3]">
<input type="text" name="${status.expression}">
</spring:bind>
The name will ultimately resolve to mycollection[3] and it's clear from this notation that the value should be inserted by a PropertyEditor into the 3rd element of the mycollection collection. Each value of the mycollection object will correspond to a single request parameterName / Value pair.
I falsely believed that multiple-select form input elements would be handled by the DataBinder similarly, as you did. Keep in mind that this kind of form input element:
Code:
<spring:bind path="command.mycollection">
<select name="${status.expression}">
....
</select>
</spring:bind>
Will result in only one parameter being passed back to the server: a CSV list of the selected elements. It will be a single parameter name / value pair, and as a GET parameter it would look like this:
Code:
http://foo.com?mycollection=22,234,42,2,234,11,232
There is no way to register a CustomPropertyEditor that will operate on each of the elements implicitly, as someone must first unmarshall that CSV string into individual values.
You can of course register an editor that accepts a string of CSV values as input, unmarshalls the values, and then operates on each value individually. You can find various solutions around this forum that do exactly that.
You would likely register such an editor like so:
Code:
registerCustomEditor(Set.class, "myImplicitCollection", new CustomUnMarshallingMojoCollectionEditor());