I need to add date to my entity and let the user set it in web form. This field needs to have today\'s date filled in by default.
1.
Use string instead of Date
@DateTimeFormat(pattern = "yyyy-MM-dd")<br>
private String fromDate;
Taking a look at the comment with the error log it seems to be a conversion problem between String to java.util.Date. After searching for a while in the Thymeleaf GitHub I saw two issues which can explain how to proceed in this case:
From the last point, I added an annotation to the start date of your project class:
// This is "org.springframework.format.annotation.DateTimeFormat"
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date start;
And after that, I was able to receive the date in your controller POST method.
Take into account you also need to change your th:value and th:field attributes from your template for the date value from ${project.start} to *{start}, as I wrote in the comments, as you did for the name and description fields.