开发者社区 问答 正文

spirngMVC 提交表单,日期是日期控件选择的,自动封装到对象中报错?报错

spirngMVC 提交表单,日期是日期控件选择的,自动封装到对象中报错,没找到解决方式啊

展开
收起
爱吃鱼的程序员 2020-06-20 17:02:31 416 分享 版权
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    在controller里面加个

    //自定义日期转换器@InitBinderpublicvoidinitBinder(WebDataBinderbinder){DateFormatfmt=newSimpleDateFormat("yyyy-MM-dd");CustomDateEditordateEditor=newCustomDateEditor(fmt,true);binder.registerCustomEditor(Date.class,dateEditor);}




    谢谢你的回答,用你的方式做了个全局的 我用jquery,绑定date没问题。1楼正解,楼主你把那个时间参数的格式转成1992-11-11类似的格式就行了谢谢
    2020-06-20 17:02:47
    赞同 展开评论
问答地址: