MVC呢,现在似乎越来越流行使用SpringMVC框架,我自己用的感觉,是非常好,确实很舒服,配置一开始是麻烦了一点点,但是后续的开发真的是很清爽!
SpringMVC配置文件
目录:resource/config/spring,文件名:spring-mvc.xml
1 <?xml version="1.0" encoding="UTF-8"?> 2 <beans xmlns="http://www.springframework.org/schema/beans" 3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 xmlns:context="http://www.springframework.org/schema/context" 5 xmlns:mvc="http://www.springframework.org/schema/mvc" 6 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> 7 8 <!--自动扫描控制器--> 9 <context:component-scan base-package="com.magic.rent.controller"/> 10 <!--视图渲染--> 11 <bean id="internalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 12 <property name="prefix" value="/WEB-INF/views/"/> 13 <property name="suffix" value=".jsp"/> 14 </bean> 15 <!--控制器映射器和控制器适配器--> 16 <mvc:annotation-driven/> 17 </beans>