如何让SpringMvc正确接收Date类型参数?

更新于
2026-10-12 09:59:14
0阅读来源:SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计69个文字,预计阅读时间需要1分钟。

如何让SpringMvc正确接收Date类型参数?

javapublic void init(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { SimpleDateFormat dateFormat=new SimpleDateFormat(yyyy-MM-dd HH:mm:ss); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));}

gistfile1.txt

@InitBinder public void init(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// dateFormat.setLenient(false); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));//把Date类型全部格式化 // initDataBinder(request, binder); }

如何让SpringMvc正确接收Date类型参数?

本文共计69个文字,预计阅读时间需要1分钟。

如何让SpringMvc正确接收Date类型参数?

javapublic void init(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { SimpleDateFormat dateFormat=new SimpleDateFormat(yyyy-MM-dd HH:mm:ss); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));}

gistfile1.txt

@InitBinder public void init(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// dateFormat.setLenient(false); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));//把Date类型全部格式化 // initDataBinder(request, binder); }

如何让SpringMvc正确接收Date类型参数?