3

<form:input type="text" />それぞれがセミコロンで区切られた複数の値を取ることができる要素があります。たとえば、 のような値を取ることができますMike;Jack;Bob

Spring 3 MVC でこのタイプの値<input>を aにバインド/渡すにはどうすればよいですか?Collection<String>

4

1 に答える 1

3

プロパティ エディタを登録できます。

@InitBinder
public void initBinder(WebDataBinder binder) {
    binder.registerCustomEditor(Collection.class, 
          new DelimitedCollectionStringEditor());
}

エディターを拡張する必要がある場所PropertyEditorSupport

于 2011-05-20T16:18:28.353 に答える