zoukankan      html  css  js  c++  java
  • web.xml文件模板

     Servlet 2.3 deployment descriptor

    注:web.xml中提示错误The content of element type "web-app" must match

    该错误的原因是元素排放顺序有误,解决其实也很简单,按照上面的描述将各元素排序即可

      1 <?xml version="1.0" encoding="UTF-8"?>
      2 <!DOCTYPE web-app PUBLIC  
      3  "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"  
      4  "http://java.sun.com/dtd/web-app_2_3.dtd" >
      5 <web-app>
      6     <icon></icon>
      7     <display-name></display-name>
      8     <description></description>
      9     <distributable />
     10     <context-param>
     11         <param-name></param-name>
     12         <param-value></param-value>
     13     </context-param>
     14     <filter>
     15         <filter-name></filter-name>
     16         <filter-class></filter-class>
     17         <init-param>
     18             <param-name></param-name>
     19             <param-value></param-value>
     20         </init-param>
     21     </filter>
     22     <filter-mapping>
     23         <filter-name></filter-name>
     24         <url-pattern></url-pattern>
     25     </filter-mapping>
     26     <listener>
     27         <listener-class></listener-class>
     28     </listener>
     29     <servlet>
     30         <servlet-name></servlet-name>
     31         <servlet-class></servlet-class>
     32         <init-param>
     33             <param-name></param-name>
     34             <param-value></param-value>
     35         </init-param>
     36     </servlet>
     37     <servlet-mapping>
     38         <servlet-name></servlet-name>
     39         <url-pattern></url-pattern>
     40     </servlet-mapping>
     41     <session-config></session-config>
     42     <mime-mapping>
     43         <extension></extension>
     44         <mime-type></mime-type>
     45     </mime-mapping>
     46     <welcome-file-list>
     47         <welcome-file></welcome-file>
     48     </welcome-file-list>
     49     <error-page>
     50         <error-code></error-code>
     51         <location></location>
     52     </error-page>
     53     <taglib>
     54         <taglib-uri></taglib-uri>
     55         <taglib-location></taglib-location>
     56     </taglib>
     57     <resource-env-ref>
     58         <description></description>
     59         <resource-env-ref-name></resource-env-ref-name>
     60         <resource-env-ref-type></resource-env-ref-type>
     61     </resource-env-ref>
     62     <resource-ref>
     63         <description></description>
     64         <res-ref-name></res-ref-name>
     65         <res-type></res-type>
     66         <res-auth></res-auth>
     67         <res-sharing-scope></res-sharing-scope>
     68     </resource-ref>
     69     <security-constraint>
     70         <display-name></display-name>
     71         <web-resource-collection>
     72             <web-resource-name></web-resource-name>
     73             <description></description>
     74         </web-resource-collection>
     75     </security-constraint>
     76     <login-config></login-config>
     77     <security-role>
     78         <description></description>
     79         <role-name></role-name>
     80     </security-role>
     81     <env-entry>
     82         <description></description>
     83         <env-entry-name></env-entry-name>
     84         <env-entry-value></env-entry-value>
     85         <env-entry-type></env-entry-type>
     86     </env-entry>
     87     <ejb-ref>
     88         <description></description>
     89         <ejb-ref-name></ejb-ref-name>
     90         <ejb-ref-type></ejb-ref-type>
     91         <home></home>
     92         <remote></remote>
     93         <ejb-link></ejb-link>
     94     </ejb-ref>
     95     <ejb-ref>
     96         <description></description>
     97         <ejb-ref-name></ejb-ref-name>
     98         <ejb-ref-type></ejb-ref-type>
     99         <home></home>
    100         <remote></remote>
    101         <ejb-link></ejb-link>
    102     </ejb-ref>
    103 </web-app>

    Servlet 2.4 deployment descriptor

    J2EE 1.4 XML schema, namespace is http://java.sun.com/xml/ns/j2ee

    <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">
    
      <display-name>Servlet 2.4 Web Application</display-name>
    </web-app>

    Servlet 2.5 deployment descriptor

    Java EE 5 XML schema, namespace is http://java.sun.com/xml/ns/javaee

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

    Java EE 6 XML schema, namespace is http://java.sun.com/xml/ns/javaee

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

    Java EE 7 XML schema, namespace is http://xmlns.jcp.org/xml/ns/javaee/

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

    仅做笔记!

    参考文档地址:http://www.mkyong.com/web-development/the-web-xml-deployment-descriptor-examples/

  • 相关阅读:
    [LeetCode]*124.Binary Tree Maximum Path Sum
    HDU3336-Count the string(KMP)
    各种配置环境变量总结
    数据结构与算法-为什么要使用算法
    request 对象
    Codeforces 15B Laser
    使用jq工具在Shell命令行处理JSON数据
    Android中的FrameLayout帧布局
    iOS 8 设置导航栏的背景颜色和背景图片
    Creating HTML table with vertically oriented text as table header 表头文字方向
  • 原文地址:https://www.cnblogs.com/brokencolor/p/8671706.html
Copyright © 2011-2022 走看看