spring mvc date format with form:input
You can use fmt:formatDate jstl tag:
<fmt:formatDate value="${yourObject.date}" var="dateString" pattern="dd/MM/yyyy" /><form:input path="date" value="${dateString} .. />
The solution is to put<mvc:annotation-driven/>
to mvc-dispatcher-servlet.xmland also xmlns:mvc="http://www.springframework.org/schema/mvc"to the begining of xml file.
in my code I use the binder in this way:
@InitBinderpublic void initBinder(WebDataBinder binder) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); dateFormat.setLenient(false); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));}