SpringMVC数据绑定大全
2016-05-05 10:32
447 查看
查看spring源码可以看出spring支持转换的数据类型已经很多了.
来自为知笔记(Wiz)
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 | /** * Actually register the default editors for this registry instance. */ private void doRegisterDefaultEditors() { this .defaultEditors = new HashMap<Class,PropertyEditor>( 64 ); // Simple editors,without parameterization capabilities. // The JDK does not contain a default editor for any of these target types. this .defaultEditors.put(Charset. class , new CharsetEditor()); this .defaultEditors.put(Class. class , new ClassEditor()); this .defaultEditors.put(Class[]. class , new ClassArrayEditor()); this .defaultEditors.put(Currency. class , new CurrencyEditor()); this .defaultEditors.put(File. class , new FileEditor()); this .defaultEditors.put(InputStream. class , new InputStreamEditor()); this .defaultEditors.put(Locale. class , new LocaleEditor()); this .defaultEditors.put(Pattern. class , new PatternEditor()); this .defaultEditors.put(Properties. class , new PropertiesEditor()); this .defaultEditors.put(Resource[]. class , new ResourceArrayPropertyEditor()); this .defaultEditors.put(TimeZone. class , new TimeZoneEditor()); this .defaultEditors.put(URI. class , new URIEditor()); this .defaultEditors.put(URL. class , new URLEditor()); // Default instances of collection editors. // Can be overridden by registering custom instances of those as custom editors. this .defaultEditors.put(Collection. class , new CustomCollectionEditor(Collection. class )); this .defaultEditors.put(Set. class , new CustomCollectionEditor(Set. class )); this .defaultEditors.put(SortedSet. class , new CustomCollectionEditor(SortedSet. class )); this .defaultEditors.put(List. class , new CustomCollectionEditor(List. class )); this .defaultEditors.put(SortedMap. class , new CustomMapEditor(SortedMap. class )); // Default editors for primitive arrays. this .defaultEditors.put( byte []. class , new ByteArrayPropertyEditor()); this .defaultEditors.put( char []. class , new CharArrayPropertyEditor()); // The JDK does not contain a default editor for char! this .defaultEditors.put( char . class , new CharacterEditor( false )); this .defaultEditors.put(Character. class , new CharacterEditor( true )); // Spring's CustomBooleanEditor accepts more flag values than the JDK's default editor. this .defaultEditors.put( boolean . class , new CustomBooleanEditor( false )); this .defaultEditors.put(Boolean. class , new CustomBooleanEditor( true )); // The JDK does not contain default editors for number wrapper types! // Override JDK primitive number editors with our own CustomNumberEditor. this .defaultEditors.put( byte . class , new CustomNumberEditor(Byte. class , false )); this .defaultEditors.put(Byte. class , new CustomNumberEditor(Byte. class , true )); this .defaultEditors.put( short . class , new CustomNumberEditor(Short. class , false )); this .defaultEditors.put(Short. class , new CustomNumberEditor(Short. class , true )); this .defaultEditors.put( int . class , new CustomNumberEditor(Integer. class , false )); this .defaultEditors.put(Integer. class , new CustomNumberEditor(Integer. class , true )); this .defaultEditors.put( long . class , new CustomNumberEditor(Long. class , false )); this .defaultEditors.put(Long. class , new CustomNumberEditor(Long. class , true )); this .defaultEditors.put( float . class , new CustomNumberEditor(Float. class , false )); this .defaultEditors.put(Float. class , new CustomNumberEditor(Float. class , true )); this .defaultEditors.put( double . class , new CustomNumberEditor(Double. class , false )); this .defaultEditors.put(Double. class , new CustomNumberEditor(Double. class , true )); this .defaultEditors.put(BigDecimal. class , new CustomNumberEditor(BigDecimal. class , true )); this .defaultEditors.put(BigInteger. class , new CustomNumberEditor(BigInteger. class , true )); // Only register config value editors if explicitly requested. if ( this .configValueEditorsActive) { StringArrayPropertyEditor sae = new StringArrayPropertyEditor(); this .defaultEditors.put(String[]. class ,sae); this .defaultEditors.put( short []. class ,sae); this .defaultEditors.put( int []. class ,sae); this .defaultEditors.put( long []. class ,sae); } } |
相关文章推荐
- 一个jar包里的网站
- 一个jar包里的网站之文件上传
- 一个jar包里的网站之返回对媒体类型
- Spring和ThreadLocal
- Spring Boot 开发微服务
- Spring整合Quartz(JobDetailBean方式)
- Spring整合Quartz(JobDetailBean方式)
- firefox下rowspan+border+border-collapse的bug
- css下margin、padding、border、background和font缩写示例
- DIV border边框显示不完全问题的解决方法
- 浅析return false的正确使用
- 学习jQuey中的return false
- 模拟Spring的简单实现
- Spring整合WebSocket应用示例(上)
- spring+html5实现安全传输随机数字密码键盘
- Spring中属性注入详解
- springmvc 发送ajax出现中文乱码的解决方法汇总
- SpringMVC框架下JQuery传递并解析Json格式的数据是如何实现的
- struts2 spring整合fieldError问题
- border:none与border:0使用区别