将URL映射到一个servlet

时间:2013-12-04 10:55:50

标签: spring spring-mvc

我使用类 org.springframework.web.servlet.mvc.ServletWrappingController 来包装一个servlet,我们需要在Spring MVC中处理一个http请求,但引用 spring mvc版本3.2 指南说:

There are also several things no longer possible:

Select a controller first with a SimpleUrlHandlerMapping or BeanNameUrlHandlerMapping

那么这就不可能了,因为api说:

<bean id="urlMapping"  class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="interceptors">
 <list>
   <ref bean="openSessionInViewInterceptor"/>
 </list>
</property>
<property name="mappings">
 <props>
   <prop key="*.do">strutsWrappingController</prop>
 </props>
</property>
</bean>

<bean id="strutsWrappingController" class="org.springframework.web.servlet.mvc.ServletWrappingController">
<property name="servletClass">
 <value>org.apache.struts.action.ActionServlet</value>
</property>
<property name="servletName">
 <value>action</value>
</property>
<property name="initParameters">
 <props>
   <prop key="config">/WEB-INF/struts-config.xml</prop>
 </props>
</property>
</bean>

如何将url映射到ServletWrappingController bean?

提前致谢。

0 个答案:

没有答案