如何让SpringMvc正确接收Date类型参数?
- 内容介绍
- 文章标签
- 相关推荐
本文共计69个文字,预计阅读时间需要1分钟。
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); }
本文共计69个文字,预计阅读时间需要1分钟。
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); }

