不同版本(2.5-3.1) web.xml文件的schema头部声明

项目用的容器是tomcat8, tomcat8 默认的是servlet 3.1的版本, 看了下 web.xml还是3.0的版本, 所以升级了下, 顺便贴一下2.5到3.1的schema头部声明。

1. Servlet 3.1

Java EE 7 XML schema,命名空间是 http://xmlns.jcp.org/xml/ns/javaee/

1
2
3
4
5
6
7
<?xml version="1.0" encoding="UTF-8"?>
<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">
</web-app>
2. Servlet 3.0

Java EE 6 XML schema,命名空间是 http://java.sun.com/xml/ns/javaee

1
2
3
4
5
6
7
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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_3_0.xsd"
version="3.0">
</web-app>
3. Servlet 2.5

Java EE 5 XML schema,命名空间是 http://java.sun.com/xml/ns/javaee

1
2
3
4
5
6
7
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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"
version="2.5">
</web-app>
Enjoy it ? Donate me !
欣赏此文?求鼓励,求支持!