ITeye博客

spring mvc从页面得到util.Date类型的数据

xiajava2011 · 2011-11-04 15:04 · Spring MVC · 开源软件 · Markdown

在控制类中加上

@InitBinder
    public void initBinder(WebDataBinder binder) {
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
    }

评论(0)

暂无评论。

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