I\'m trying to bind one of my model objects to the fields of a form, using Spring-MVC. Everything works fine, except that one of the attributes of the model object is an unorder
You can use a semi-colon-delimited list if you're using numeric references to the IDs of objects, and an appropriate Converter implementation registered.
POST data leaderboards=1,2
Converter implementation (ignore the JSON stuff)
public final class LeaderboardConverter extends JsonDeserializer implements Converter
{
public Leaderboard convert(String source) throws IllegalArgumentException
{
Leaderboard activity = new Leaderboard();
activity.setId(new Integer(source));
return activity;
}
public Leaderboard deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException
{
return convert(jp.getText());
}
}