私は次のようなオブジェクトを持っています:
public class FormFields extends BaseObject implements Serializable {
private FieldType fieldType; //checkbox, text, radio
private List<FieldValue> value; //FieldValue contains simple string/int information, id, value, label
//other properties and getter/setters
}
FormFields のリストをループし、fieldType がラジオ ボタンと等しくない場合は、JSP を使用してフィールド値のリストを出力しています。
<c:forEach items=${formField.value}></c:forEach>
これはすべて良好で、正常に動作します。
これ以外に、fieldType がラジオであるかどうかをチェックします。
<form:radiobuttons path="formFields[${formFieldRow.index}].value" items="${formField.value}" itemLabel="label" cssClass="radio"/>
ただし、これにより、次のようなエラーが発生する問題が発生しています。
Failed to convert property value of type [java.lang.String] to required type [java.util.List] for property formFields[11].value; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [com.example.model.FieldValue] for property value[0]: no matching editors or conversion strategy found
これをグーグルで検索し、Stack Overflow を検索して、registerCustomEditor および同様の関数への参照を見つけましたが、これを適切に解決する方法がわかりません。
カスタム プロパティ エディタはこれに対応する方法ですか? もしそうなら、それはどのように機能しますか?