Failed to convert property value of type java.lang.String to required type java.util.Date

Today while adding to Java file a text box of date, i got below error while updating it:

Failed to convert property value of type java.lang.String to required type java.util.Date

Problem:
The problem here that Spring cannot put the data into object and cannot map it's format, the solution is to bind it to format you want to use.

Solution:
A data binder is needed, what is that ? how it's implemented ? let me answer those questions in the coming few lines.

If you have a date in a format like "mm-dd-yyyy" then it needs to be parsed, either you will do it manually after the @RequestParam Date or you will use like below or even using the WebDataBinder like Ex#2:
Continue reading

How to format date in Java Spring JSP

How to format the date in the JSP ?
You need to add in the jsp a tag library which used for formatting which called JSTL format, below is the JSP "View" part:

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<fmt:formatDate pattern="dd-MM-yyyy" value="${project.projectStartdate}" />