0
하나의 BigDecimal 필드가있는 POJO 객체가 있습니다. 합계입니다. 컨트롤러에서
내가 같은 형태로이 POJO 객체를 추가봄 BigDecimal 입력
MyForm form = new MyForm();
model.addAttribute("command", form);
내 JSP :
내가 initbinder 추가 컨트롤러에서<form:input path="sum" size="27"/>
:
binder.registerCustomEditor(BigDecimal.class, new SumEditor());
내 SumEditor 클래스의 일부 :
@Override
public void setAsText(String text) throws IllegalArgumentException {
setValue(parseMoney(text));
}
private BigDecimal parseMoney(String str) {
try {
return new BigDecimal(str);
} catch (Exception e) {
logger.error("error", e);
}
return null;
}
하지만 JSP보기에서 (입력 필드에서) | null ________ |
해결 방법 나는 필요로한다 : | ___________ |
SumEditor
의
getText
메소드를 오버라이드 (override)