我在添加和修改是只要是有关日期类型的字段就会报错

我用的pastgresql数据库 ,Springmvc hibernate,Spring,frame框架!
错误信息是:
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 ''; nested exception is java.lang.IllegalArgumentException

实体类:

private Date birthday;

pastgresql数据库中

birthday date,

jsp代码中

如何解决啊,帮忙解决一下,谢了

尼玛,你传的String类型的参数,还想让它给你转成date类型?

那我如何转换呢,

用SimpleDataFormat

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//需要时分秒使用这个

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");//只要年月日 用这个

// startDate 是你的String类型的日期
java.sql.Date dateTime = new java.sql.Date(sdf.parse(startDate).getTime());

最后传出 dateTime 这个日期变量就行

将实体类中的日期属性改成string类型,或者Action中对收到的日期字符串手动进行转换处理。