I have quite complicated html form and I'm trying to map it to models. Form contains information about Board (name, date, owner, etc...) and list of Items. Each item contains some data too. Items are added/deleted dynamically so I use JS to add indexes before form is sent. Here is part of my form:
<div>
<label>Link:</label>
<input type="text" name="items[<index>].link">
<label>JScript:</label>
<select name="items[<index>].javaScript">
<option>disable</option>
<option>enable</option>
</select>
</div>
I use form's onsubmit function to change to appropriate value. It maps fine for my model which is Board with List of items:
public class Board
{
private long id;
private User owner;
private String title;
private List<Item> items;
...
}
what I would like to do is register custom editor or converter for List because I need to do some manual changes.
I've tried
binder.registerCustomEditor(Item.class, "items", new PropertyEditorSupport()
and
binder.registerCustomEditor(List.class, "board.items", new CustomCollectionEditor(List.class)
but it doesn't work at all.
Aucun commentaire:
Enregistrer un commentaire