tomcat之web.xml头Doctype/ 命名空间定义

在开发java web应用的时候,都需要定义web.xml,使用不同版本的servlet在定义web.xml头部信息是不一样的,下面罗列一下大部分servlet对应的头部信息:

servlet 2.3 

  <!DOCTYPE web-app PUBLIC

"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"

"http://java.sun.com/dtd/web-app_2_3.dtd">

servlet 2.4

           <web-app xmlns="http://java.sun.com/xml/ns/j2ee"

     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"

     version="2.4">

     ...

   </web-app>

servlet 2.5

            <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>

servlet 3.0

      <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>

servlet 3.1

      <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>

这些信息是在eclipse中发现的,附件中jar有对应的dtd定义。

猜你喜欢

转载自bozch.iteye.com/blog/2312108