您的位置:首页 > 编程语言 > Java开发

spring 日期时间提交出现400错误

2017-04-06 16:30 274 查看
在action 中加入以下代码可以解决问题

    @InitBinder

    public void initBinder(WebDataBinder binder) {

        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        dateFormat.setLenient(false);

        binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));

    }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  spring mvc
相关文章推荐