spring 几个很实用功能 介绍
2011-11-25 15:48
627 查看
首先说明这些都是在WEB.xml里面配置的
1. 用来做编码过滤 java代码和jsp代码编码存在不同,乱码问题都可以通过这个得到解决俄!
<filter>
<filter-name>Spring character encoding filter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
2. 这个配置是用来指定spring配置文件所在的位置的
<context-param>
<description>spring init </description>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/bean.xml</param-value>
</context-param>
3.这个是用来对spring容器进行初始化,做为监听器的
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
4.这是Spring封装hibernate后提供的一个过滤器,这个过滤器的作用是:每一次请求来的时候都打开一个session每次请求结束后关闭session,解析hibernat延迟加载产生的异常。
<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
1. 用来做编码过滤 java代码和jsp代码编码存在不同,乱码问题都可以通过这个得到解决俄!
<filter>
<filter-name>Spring character encoding filter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
2. 这个配置是用来指定spring配置文件所在的位置的
<context-param>
<description>spring init </description>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/bean.xml</param-value>
</context-param>
3.这个是用来对spring容器进行初始化,做为监听器的
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
4.这是Spring封装hibernate后提供的一个过滤器,这个过滤器的作用是:每一次请求来的时候都打开一个session每次请求结束后关闭session,解析hibernat延迟加载产生的异常。
<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
相关文章推荐
- spring boot与spring mvc的区别及功能介绍
- 介绍 Spring 3.1 M1 中的缓存功能
- 介绍 Spring 3.1 M1 中的缓存功能
- 几个非常实用的Eclipse功能介绍
- 介绍 Spring 3.1 M1 中的缓存功能
- SpringBoot学习(二)SpringBoot一些很实用的功能
- 介绍 Spring 3.1 M1 中的缓存功能
- 介绍几个功能强大WINDOWS命令
- Spring学习之Jar包功能介绍(转)
- spring-boot-klock-starter V1.1 主体功能重大更新内容介绍
- 使用springBoot的拦截器功能介绍
- Xbox Live的几个主要娱乐功能介绍
- 几个对VS2008功能介绍的网站
- Spring AppliactionContext功能介绍
- J2EE框架下几个通用功能介绍
- spring AOP 之一:spring AOP功能介绍
- 图片上传功能的几个工具类的介绍
- 介绍 Spring 3.1 M1 中的缓存功能
- 介绍几个功能强大WINDOWS命令
- 几个非常实用的Eclipse功能介绍