配置DispatcherServlet

来源:互联网 发布:掌盟书城java下载 编辑:程序博客网 时间:2024/06/07 14:29

将DispatcherServlet注册到web容器


<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee                      http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"version="3.1" metadata-complete="true"><!-- 修改servlet版本为3.1 --><!-- 配置DispatcherServlet --><servlet><servlet-name>seckill-dispatcher</servlet-name><servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class><!-- 配置springMVC需要加载的配置文件spring-dao.xml,spring-service.xml,spring-web.xmlMybatis - > spring -> springmvc --><init-param><param-name>contextConfigLocation</param-name><param-value>classpath:spring/spring-*.xml</param-value></init-param></servlet><servlet-mapping><servlet-name>seckill-dispatcher</servlet-name><!-- 默认匹配所有的请求 --><url-pattern>/</url-pattern></servlet-mapping></web-app>




1 0
原创粉丝点击