[url]http://my.oschina.net/u/2274056/blog/363858[/url]
@InitBinder
protected void initBinder(HttpServletRequest request,
ServletRequestDataBinder binder) throws Exception {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
CustomDateEditor editor = new CustomDateEditor(df, false);
binder.registerCustomEditor(Date.class, editor);
}
本文展示了一个使用Spring MVC框架中@InitBinder注解的具体示例。通过注册自定义日期编辑器来处理HTTP请求中的日期格式,确保了数据类型的正确转换。
609

被折叠的 条评论
为什么被折叠?



