spring mvc 前台到后台时间类型处理

Controller类里面:

 

@InitBinder
     protected void initBinder(HttpServletRequest request,
            ServletRequestDataBinder binder) throws Exception {
        // DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        CustomDateEditor dateEditor = new CustomDateEditor(format, true);
        binder.registerCustomEditor(Date.class, dateEditor);
        super.initBinder(request, binder);
   }

 

你可能感兴趣的:(spring mvc)