码迷,mamicode.com
首页 > Web开发 > 详细

web.xml

时间:2016-12-20 16:08:57      阅读:230      评论:0      收藏:0      [点我收藏+]

标签:class   http   1.0   htm   javaee   list   val   匹配   cat   

web.xml的url映射的小知识:
<url-pattern>/</url-pattern>  会匹配到/login这样的路径型url,不会匹配到模式为*.jsp这样的后缀型url
<url-pattern>/*</url-pattern> 会匹配所有url:路径型的和后缀型的url(包括/login,*.jsp,*.js和*.html等)

案例:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">

<display-name>Task</display-name>
<!-- <context-param>
<param-name>webAppRootKey</param-name>
<param-value>Task.root</param-value>
</context-param> -->
<!-- spring配置 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring.xml</param-value>
</context-param>
<!-- 加载spring配置文件:启动spring -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

</web-app>

web.xml

标签:class   http   1.0   htm   javaee   list   val   匹配   cat   

原文地址:http://www.cnblogs.com/21heshang/p/6202847.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!