spring mvc date format with form:input

java, jpa, jstl, spring, spring-mvc

Solution

The solution is to put `<mvc:annotation-driven/>` to mvc-dispatcher-servlet.xml and also xmlns:mvc="http://www.springframework.org/schema/mvc" to the begining of xml file.

Problem

I have hibernate entity and a 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; } } ``` also I have ``` @InitBinder protected void initBinder(WebDataBinder binder) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); binder.registerCustomEditor(Date.class, new CustomDateEditor( dateFormat, false)); } ``` and ``` form:input id = "datepicker" name="date" itemLabel="date" path="newObservation.date" ``` When I go to my url I see: How can I force it to have mm/DD/yyyy format? Thanx

Original source

Related problems