gistfile1.txt @InitBinderpublic void init(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// dateFormat.setLenient(false); binder.regi
@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);
}
