HowTo: Bind an input field to a Date property using Spring's SimpleFormController
1 min read
1 min read
<form:input path="expiryDate" size="15" />
@Override
protected void initBinder(PortletRequest request, PortletRequestDataBinder binder) throws Exception {
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
df.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(df, true));
super.initBinder(request,binder);
}