springmvc-时间类型转换器

springmvc 没有默认实现时间类型的转化,需要如下代码实现此功能。

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

原文地址:https://www.cnblogs.com/wlhebut/p/6266729.html