SpringMVC 出现"The request sent by the client was syntactically incorrect ()"解决办法

悠悠 2022-06-12 01:38 303阅读 0赞

问题描述:
这里写图片描述

原因:
Spring在转换日期出错

解决方法:
在Controller中添加

  1. @InitBinder
  2. public void initBinder(WebDataBinder binder) {
  3. SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
  4. dateFormat.setLenient(false);
  5. binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
  6. }

发表评论

表情:
评论列表 (有 0 条评论,303人围观)

还没有评论,来说两句吧...

相关阅读