마
public enum TestType {
MAN("Man"),
FEMALE("Female");
private String description;
private TestType(String description) {
this.description = description;
}
public String getValue() {
return name();
}
public void setValue(String value) {}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
을 다음과
model.addAttribute(TestType.values());
을 다음과 같이 귀하는 TestType을 설정 그리고
dataBinder.registerCustomEditor(TestType.class, new PropertyEditorSupport() {
@Override
public void setAsText(String value) throws IllegalArgumentException {
if(StringUtils.isBlank(value))
return;
setValue(TestType.valueOf(value));
}
@Override
public String getAsText() {
if(getValue() == null)
return "";
return ((TestType) getValue()).name();
}
});
<form:radiobuttons path="type" items="${testTypeList}" itemLabel="description"/>
다음과 같이 정의 바인더를 등록으로
내 잘못입니다. 유형이 _Enum이었습니다 type_ _TestType type_ (으)로 변경되었으며 정상입니다! –
Alexander