日期:2014-05-19  浏览次数:20580 次

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>