ITeye博客

SpringMVC日期绑定

theseus · 2017-10-24 15:48 · Spring · 开源软件 · Markdown

在controller中添加以下代码自动绑定日期参数

@InitBinder
public void initData(WebDataBinder wdb) {
	wdb.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy-MM-dd"), true));
}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。