Spring MVC配置详解(2)---bai
2017-01-11 08:15
288 查看
web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <servlet> <servlet-name>springmvc</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>springmvc</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>
springmvc-servlet.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation= "http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <!-- 配置注解的扫描路径。控制器包中 --> <context:component-scan base-package="com.etc.controller"/> <!-- 创建1个视图解析器,支持jsp --> <bean id="viewResovler" class="org.springframework.web.servlet.view.UrlBasedViewResolver"> <!-- 视图文件的前缀 --> <property name="prefix" value="/WEB-INF/jsp/"/> <!-- 视图文件的后缀 --> <property name="suffix" value=".jsp"/> <!-- 视图文件的具体类型 --> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> </bean> </beans>
相关文章推荐
- Spring MVC的annotaction配置详解
- Spring MVC配置文件的三个常用配置详解
- spring MVC配置详解
- 基于注解的Spring MVC 框架搭建及配置详解
- spring MVC配置详解
- Spring MVC常用配置模板详解
- spring mvc 配置(xml配置详解)
- spring MVC配置详解
- spring mvc 配置(xml配置详解)
- spring mvc 配置(xml配置详解)
- spring MVC配置详解
- spring MVC配置详解
- spring MVC配置详解
- spring MVC配置详解
- spring mvc 配置(xml配置详解)
- Spring MVC配置文件的三个常用配置详解
- Spring MVC配置详解
- spring mvc 配置(xml配置详解)
- Spring MVC 框架搭建配置方法及详解
- spring MVC配置详解