小红树 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 我想在一个软件里添加一个优惠弹窗,应该怎么写代码
  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流