springMvc配置转发请求三种方法SimpleUrlHandlerMapping
<?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>
springMvc简单的登录程序小项目 :http://www.52itstyle.top/thread-2737-1-1.html
页:
[1]