开发者社区> 问答> 正文

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

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

展开
收起
爱吃鱼的程序员 2020-06-20 17:02:31 387 0
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
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载