当前位置: 代码迷 >> Web前端 >> hibernateFilter功用(在web.xml中配置)
  详细解决方案

hibernateFilter功用(在web.xml中配置)

热度:36   发布时间:2012-11-03 10:57:43.0
hibernateFilter作用(在web.xml中配置)

?

1.
<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>GBK</param-value>
</init-param>
这个是用来处理乱码问题的

更多了解,更多交流(QQ:444084929 软件框架师 :回钦波)

?

2.
<context-param>
<description>spring init </description>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/bean.xml</param-value>
</context-param>
这个配置是用来指定spring配置文件所在的位置的

3.

<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
这个是用来对spring容器进行初始化,做为监听器的

?

?

4.

<filter>

??? <filter-name>hibernateFilter</filter-name>

??? ??? <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>

</filter>

?

这是Spring封装hibernate后提供的一个过滤器,这个过滤器的作用是:每一次请求来的时候都打开一个session每次请求结束后关闭session,解析hibernat延迟加载产生的异常。

  相关解决方案