WebBindingInitializer学习
2016-03-22 14:26
357 查看
今天在看开源代码的时候遇到了这个接口,于是查阅了下相关的资料
Spring web mvc学习笔记
/article/5794271.html
WebBindingInitializer 接口来实现全局注册 使用@InitBinder只能对特定的controller类生效,为注册一个全局的customer Editor,可以实现接口WebBindingInitializer 。
并修改 servlet context xml配置文件
但这样一来就无法使用mvc:annotation-driven 了
Spring web mvc学习笔记
/article/5794271.html
WebBindingInitializer 接口来实现全局注册 使用@InitBinder只能对特定的controller类生效,为注册一个全局的customer Editor,可以实现接口WebBindingInitializer 。
public class CustomerBinding implements WebBindingInitializer { @Override public void initBinder(WebDataBinder binder, WebRequest request) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); dateFormat.setLenient(false); binder.registerCustomEditor(Date.class, new CustomDateEditor( dateFormat, false)); }
并修改 servlet context xml配置文件
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> <property name="webBindingInitializer"> <bean class="net.zhepu.web.customerBinding.CustomerBinding" /> </property> </bean>
但这样一来就无法使用mvc:annotation-driven 了
相关文章推荐
- mybatis3通用crud的研究二
- AndroidSample之ZoomActivity的学习
- Hibernate的Hql语句使用in关键字
- 拦截器
- WIN7下使用iis搭建php环境(上)
- mysql中int、bigint、smallint 和 tinyint的区别与长度的含义
- squid代理服务器搭建及配置
- 自定义控件入门(二)
- Android 从相册中选择照片并返回
- 获取元素CSS值之getComputedStyle方法熟悉
- [LeetCode]题解(python):125-Valid Palindrome
- 开启关闭功能没有生效的原因
- VC CFont 用法
- 如何离线查看Windows API和网上查询Windows API
- Shell技巧
- VS2008加快编译速度方法
- POJ1426 Find The Multiple(DFS||BFS||同余模定理)
- 【IOS开发】企业版IDP分发(In-house模式)新规提示
- sso package or sign error解决方案
- Ubuntu文本编辑(vi和nano)命令