小编Pau*_*hez的帖子

无法将类型“java.lang.String”的属性值转换为所需类型“java.util.Date”

我正在尝试使用 Spring MVC、Java 和 MySql 在我的 web 应用程序中实现完整的日历插件。当我尝试在 jsp 中使用“input type = date”添加日期时,出现此错误:

Field error in object 'event' on field 'endDate': rejected value [2018-03-13]; 
codes [typeMismatch.event.endDate,typeMismatch.endDate,typeMismatch.java.util.Date,typeMismatch];
arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [event.endDate,endDate]; arguments [];
default message [endDate]]; default message [Failed to convert property value of type 'java.lang.String' 
to required type 'java.util.Date' for property 'endDate'; nested exception is org.springframework.core.convert.ConversionFailedException: 
Failed to convert from type java.lang.String to type @org.springframework.format.annotation.DateTimeFormat
java.util.Date for value '2018-03-13'; 
nested exception is java.lang.IllegalArgumentException: Unable to parse '2018-03-13']
Run Code Online (Sandbox Code Playgroud)

在我的控制器类中,我使用 SimpleDateFormat 来格式化我的日期: …

java mysql spring-mvc fullcalendar

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

fullcalendar ×1

java ×1

mysql ×1

spring-mvc ×1