小红树 2012-07-24 11:31 采纳率: 0%
浏览 349
已采纳

springmvc2.5中绑定表单日期字段报错,请大神帮忙

action为MultiActionController
绑字数据方法为
Article formData = (Article)newCommandObject(Article.class);
bind(request, formData);
其中有一个字段类型为Date型
页面文件字段为

提示:Errors binding onto object 'command'; nested exception is org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors Field error in object 'command' on field 'createTime': rejected value [2012-07-24]; codes [typeMismatch.command.createTime,typeMismatch.createTime,typeMismatch.java.sql.Timestamp,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [command.createTime,createTime]; arguments []; default message [createTime]]; default message [Failed to convert property value of type [java.lang.String] to required type [java.sql.Timestamp] for property 'createTime'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [java.sql.Timestamp] for property 'createTime': no matching editors or conversion strategy found]

•返回

请问如何解决????????

  • 写回答

4条回答 默认 最新

  • weixin_42608382 2012-07-24 12:57
    关注

    [url]http://forum.springsource.org/showthread.php?48979-How-to-bind-to-java.sql.Timestamp[/url]

    晕,就是说只能用Date类型的

    最好是这样的,比起我们,spring的工程师,应该更见多实广吧,改一下类型,也不影响什么。ORM 会对日期类型很好的转换的。 :lol:

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置