我有休眠实体和一个bean:
@Entity
public class GeneralObservation {
@DateTimeFormat(pattern = "dd/MM/yyyy")
Date date;
@Column
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
}
我也有
@InitBinder
protected void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
binder.registerCustomEditor(Date.class, new CustomDateEditor(
dateFormat, false));
}
和
form:input
id = "datepicker"
name="date"
itemLabel="date"
path="newObservation.date"
当我转到我的网址时,我看到:
如何强制它具有 mm/DD/yyyy 格式?谢谢