您的位置:首页 > 运维架构

OpenSessionViewFilter失效问题

2009-05-10 19:35 274 查看
struts和spring结合需要在struts-config.xml里面配置plugin:

<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="classpath:spring/*.xml"/>
</plug-in>

web.xml加入:

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/*.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

配置OpenSessionViewFilter:

<filter>
<filter-name>opensession</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>opensession</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

测试结果:如果在struts-config.xml中加入plugin,则OpenSessionViewFilter失效。

去掉plugin后,问题解决。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: