SpringMVC传参日期字符串报错处理

来源:互联网 发布:lol韩服加速器mac版 编辑:程序博客网 时间:2024/05/16 05:14

SpringMVC传参日期字符串报错处理

在调用方法里加入如下代码即可:
@InitBinderprotected void initBinder(WebDataBinder binder) {    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");    binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));}
1 0
原创粉丝点击