---
title: "OpenSessionInView"
author: "zgzd13575java"
date: "2008-11-22T22:27:40Z"
tags: []
slug: "opensessioninview"
draft: false
lastmod: "2008-11-26T12:10:45Z"
id: 274531
url: "https://zgzd13575java.iteye.com/blog/274531"
---

<!--web.xml处加入-->
<!-- OpenSessionmInView过滤器 -->
<filter>
	<filter-name>OpenSessionInViewFilter</filter-name>
	<filter-class>
		org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
	</filter-class>
</filter>
<filter-mapping>
	<filter-name>OpenSessionInViewFilter</filter-name>
	<url-pattern>*.do</url-pattern>
</filter-mapping>

<!-- 装载spring上下文 -->
<listener>
	<listener-class>
		org.springframework.web.context.ContextLoaderListener
	</listener-class>
</listener>

<context-param>
	<param-name>contextConfigLocation</param-name>
	<param-value>
		/WEB-INF/classes/applicationContext.xml
	</param-value>
</context-param>

SSH整合时,struts-config忽加入

<!-- Spring上下文插件 -->
<plug-in
	className="org.springframework.web.struts.ContextLoaderPlugIn">
	<set-property
		value="/WEB-INF/classes/applicationContext.xml,/WEB-INF/classes/action-servlet.xml"
		property="contextConfigLocation" />
</plug-in>