Hallo everyone i’m trying to use the initbinder annotations in order to match the values i receive from a multiply list box.The values from the list box are String values.Iinitially i did it with the following way just to match only one choice(i didn’t add the multiply choice yet) and it works perfectly fine. The code is the following:
At the controller i have this:
@InitBinder
public void initBinderResearch(WebDataBinder b) {
b.registerCustomEditor(Research.class, new ResearchEditor());
}
At the debuging i can see that the binding of the research_area values is not successful.But i don’t take any exception or error.Can anyone tell me what i’m doing wrong and this is not working?
You can’t override
PropertyEditor.setAsText(List<String> text)because it not exists in parent class andWebDataBinderwill not use this method to make string to object conversions.If you register your original
ResearchEditorand change the property from typeResearchto typeList<Research>in your backing form model, the WebDataBinder will convert thems.