`

Spring MVC3的OpenSessionInView

阅读更多
Spring MVC3因为可以用注释来定义Control,所以不需要在配置文件中写urlMapping
所以要使用OpenSessionInViewInterceptor,可以这样配置

<bean id="openSessionInViewInterceptor"
		class="org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor">
	<property name="sessionFactory">
		<ref bean="sessionFactory"/>
	</property>
</bean>


<bean id="handlerMapping"    
class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
	    <property name="interceptors" ref="openSessionInViewInterceptor"></property>
</bean>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics