SimpleUrlHandlerMapping 根据定义转发请求,map from URLs to request handler beans
---------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="loginController" class="com.spring.web.controller.LoginController"/>
<bean id="handlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<!-- 配置方法一
<property name="urlMap">
<map>
<entry key="/user/login.do" value-ref="loginController"/>
</map>
</property> -->
<!-- 配置方法二
<property name="mappings">
<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="location">
<value>urlMap.properties</value <!-- 此时urlMap.properties文件应放在WebRoot目录下! -->
</property>
</bean>
</property>
-->
<!-- 配置方法三 -->
<property name="mappings">
<props>
<prop key="/user/login.do">loginController</prop>
</props>
</property></bean>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix"><value>/WEB-INF/jsp/</value></property>
<property name="suffix"><value>.jsp</value></property>
<property name="viewClass">
<value>
org.springframework.web.servlet.view.JstlView
</value>
</property>
</bean>
</beans>
---------------------------------
<!-- SimpleUrlHandlerMapping 根据定义转发请求, map from URLs to request handler beans -->
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="**/*.do">strutsWrappingController</prop>
</props>
</property>
</bean>