十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
页面报错:
后台错误:
Field error in object 'user' on field 'birthday': rejected value [2013-06-24]; codes [typeMismatch.user.birthday,typeMismatch.birthday,typeMismatch.java.util.Date,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [user.birthday,birthday]; arguments []; default message [birthday]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'birthday'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type java.util.Date for value '2013-06-24'; nested exception is java.lang.IllegalArgumentException]
解决方案1:在对应的实体类属性上加入 @DateTimeFormat(pattern = "yyyy-MM-dd")
解决方案2:不使用
使用 DefaultAnnotationHandlerMapping 和 AnnotationMethodHandlerAdapter 注解驱动配置
在对应的实体类属性上加入 @DateTimeFormat(pattern = "yyyy-MM-dd")