配置都是一行一行敲么?
如mvc-dispatcher-servlet.xml文件配置,有模版么?有的话在哪找?
如mvc-dispatcher-servlet.xml文件配置,有模版么?有的话在哪找?
2015-07-14
各位观众,我来帮你们省时间,mvc-dipatcher-servlet.xml请拿去:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
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.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">
<!-- 定义扫描Controller包下的内容 -->
<context:annotation-config />
<!-- <context:annotation-config/> -->
<!-- 对module包中的所有类进行扫描,以完成Bean创建和自动依赖注入的功能 -->
<context:component-scan
base-package="com.imooc.mvcdemo">
<context:include-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
</context:component-scan>
<!-- @Controller注解的使用前提配置 详细解释见(注. 1. ) -->
<mvc:annotation-driven />
<!-- 启动Spring MVC的注解功能,完成请求和注解POJO的映射 <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"
/> -->
<!-- 定义视图解析器,在视图模型前后添加前缀后缀 暂时只支持jsp后缀 -->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsps/" /><!-- 路径前缀 -->
<property name="suffix" value=".jsp" /><!-- 后缀 -->
</bean>
</beans>
举报