Spring MVC3因为可以用注释来定义Control,所以不需要在配置文件中写urlMapping
所以要使用OpenSessionInViewInterceptor,可以这样配置
所以要使用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>