读书人

OpenSessionInViewInterceptor配置方法

发布时间: 2012-05-23 13:44:13 作者: rapoo

OpenSessionInViewInterceptor配置方法?
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="interceptors" ref="openSessionInViewInterceptor"/>
<property name="mappings">
<props>
......
</props>
</property>
</bean>

props里面要写什么?怎么写

[解决办法]
例子:<prop key="continueRent.make">continueRent</prop>
key内面填的就好像是servlet的url-pattern,continueRent就是spring的控制器的bean的id:

<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="continueRent.make">continueRent</prop>
</props>
</property>
</bean>
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.InternalResourceView</value>
</property>
</bean>
<bean id="continueRent" class="springcontroller.ContinueRentController">
<property name="viewPage">
<value>/personcontact/rentstate.jsp</value>
</property>
</bean>

读书人网 >J2EE开发

热点推荐