<pre name="code" class="html"><pre name="code" class="html">OpenSessionInViewFilter是一个不错的解决因hiberante session 关闭 而懒加载不能正常使用的方法
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:web_spring.xml</param-value>
</context-param>
<filter>
<filter-name>openSession</filter-name>
<filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>openSession</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>