spring中页面传递参数为Date类型自动转换为字符串的方法

 

@InitBinder
public void initBinder(WebDataBinder binder){
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
binder.registerCustomEditor(Date.class, new CustomDateEditor(sdf, true));

}

一般定义在Action的抽象父类的方法中。

posted @ 2017-06-15 00:23  魅力咔咔  阅读(344)  评论(0编辑  收藏  举报