May 23rd, 2012, 01:11 AM
Using one model object property to set another property of the same model
In my Spring MVC form, I have a String property of a model object that is bound to a hidden field of a form. I have two select boxes, one pre-populated and the other initially empty. In the form, I use JQuery to move the items from the pre-populated list to the empty one on click event. The hidden field is also populated with the items that are moved to the empty list. On submit, the String property of the model is populated but I need to parse the String to construct an ArrayList of objects which is another property of the same model.
I was wondering what is the most elegant way of achieving this. Should I use a custom PropertyEditor to somehow populate the ArrayList or a converter?