web.xml文件模板
Servlet 2.3 deployment descriptor
注:web.xml中提示错误The content of element type "web-app" must match
该错误的原因是元素排放顺序有误,解决其实也很简单,按照上面的描述将各元素排序即可
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<icon></icon>
<display-name></display-name>
<description></description>
<distributable />
<context-param>
<param-name></param-name>
<param-value></param-value>
</context-param>
<filter>
<filter-name></filter-name>
<filter-class></filter-class>
<init-param>
<param-name></param-name>
<param-value></param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name></filter-name>
<url-pattern></url-pattern>
</filter-mapping>
<listener>
<listener-class></listener-class>
</listener>
<servlet>
<servlet-name></servlet-name>
<servlet-class></servlet-class>
<init-param>
<param-name></param-name>
<param-value></param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name></servlet-name>
<url-pattern></url-pattern>
</servlet-mapping>
<session-config></session-config>
<mime-mapping>
<extension></extension>
<mime-type></mime-type>
</mime-mapping>
<welcome-file-list>
<welcome-file></welcome-file>
</welcome-file-list>
<error-page>
<error-code></error-code>
<location></location>
</error-page>
<taglib>
<taglib-uri></taglib-uri>
<taglib-location></taglib-location>
</taglib>
<resource-env-ref>
<description></description>
<resource-env-ref-name></resource-env-ref-name>
<resource-env-ref-type></resource-env-ref-type>
</resource-env-ref>
<resource-ref>
<description></description>
<res-ref-name></res-ref-name>
<res-type></res-type>
<res-auth></res-auth>
<res-sharing-scope></res-sharing-scope>
</resource-ref>
<security-constraint>
<display-name></display-name>
<web-resource-collection>
<web-resource-name></web-resource-name>
<description></description>
</web-resource-collection>
</security-constraint>
<login-config></login-config>
<security-role>
<description></description>
<role-name></role-name>
</security-role>
<env-entry>
<description></description>
<env-entry-name></env-entry-name>
<env-entry-value></env-entry-value>
<env-entry-type></env-entry-type>
</env-entry>
<ejb-ref>
<description></description>
<ejb-ref-name></ejb-ref-name>
<ejb-ref-type></ejb-ref-type>
<home></home>
<remote></remote>
<ejb-link></ejb-link>
</ejb-ref>
<ejb-ref>
<description></description>
<ejb-ref-name></ejb-ref-name>
<ejb-ref-type></ejb-ref-type>
<home></home>
<remote></remote>
<ejb-link></ejb-link>
</ejb-ref>
</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/
web.xml文件模板的更多相关文章
- web.xml文件:
在web.xml配置文件是一个的J2EE配置文件,决定如何处理HTTP请求servlet容器的元素.它不是严格意义上的Struts2的配置文件,但它是一个文件,需要配置Struts2的工作. 正如前面 ...
- web.xml文件加载顺序
1.启动一个WEB项目的时候,WEB容器会去读取它的配置文件web.xml,读取<listener>和<context-param>两个结点. 2.紧急着,容创建一个Servl ...
- Java Web的web.xml文件作用及基本配置(转)
其实web.xml就是asp.net的web.config一个道理. 说明: 一个web中完全可以没有web.xml文件,也就是说,web.xml文件并不是web工程必须的. web.xml文件是用来 ...
- web.xml文件详解
web.xml文件详解 Table of Contents 1 listener. filter.servlet 加载顺序 2 web.xml文件详解 3 相应元素配置 1 listener. f ...
- web.xml 文件配置01
web.xml 文件配置01 前言:一般的web工程中都会用到web.xml,方便开发web工程.web.xml主要用来配置Filter.Listener.Servlet等.但是要说明的是web. ...
- web.xml文件中的web-app元素 部署
[转载]web.xml文件中的web-app元素 (2012-05-24 13:35:57) 转载▼ 标签: 转载 分类: java 挺全 的 呵呵呵 转了 原文地址:web.xml文件中的web-a ...
- WEB项目web.xml文件中classpath: 跟classpath*:使用的区别
引用一篇很不错的文章:http://blog.csdn.net/wxwzy738/article/details/16983935 首先 classpath是指 WEB-INF文件夹下的classes ...
- web.xml文件中加载顺序的优先级
在项目中总会遇到一些关于加载的优先级问题,近期也同样遇到过类似的,所以自己查找资料总结了下,下面有些是转载其他人的,毕竟人家写的不错,自己也就不重复造轮子了,只是略加点了自己的修饰. 首先可以肯定的是 ...
- web.xml文件的作用
每个javaEE工程中都有web.xml文件,那么它的作用是什么呢?它是每个web.xml工程都必须的吗? 一个web中可以没有web.xml文件,也就是说,web.xml文件并不是web工程必须的. ...
随机推荐
- [HNOI2019]校园旅行(构造+生成树+动规)
题目 [HNOI2019]校园旅行 做法 最朴素的做法就是点对扩展\(O(m^2)\) 发现\(n\)比较小,我们是否能从\(n\)下手减少边数呢?是肯定的 单独看一个颜色的联通块,如果是二分图,我们 ...
- 20145324 《Java程序设计》第3周学习总结
20145324 <Java程序设计>第3周学习总结 教材学习内容总结 第四章 1.要产生对象必须先定义类,类是对象的设计图,对象是类的实例,建立实例要用new 2.参数名称与对象数据成员 ...
- 都能看懂的嵌入式linux/android alsa_aplay alsa_amixer命令行用法
前几天在嵌入式linux上用到alsa command,网上查的资料多不给力,只有动手一点点查,终于可以用了,将这个使用方法告诉大家,以免大家少走弯路. 0.先查看系统支持哪几个alsa cmd: l ...
- lua5.3中luaL_setfunc设置upvalue的用法示例
缘起 luaL_setfuncs 这个函数可以注册c函数到lua,另外还可以设置闭包函数使用的变量upvalue. 我没有用过,在 云风的skynet 才第一次见过,于是写个例子实际使用以下. 函数原 ...
- linux下挂载ISO像镜文件
挂载命令(mount) 命令格式:mount [-t vfstype] [-o options] device dir其中:1.-t vfstype 指定文件系统的类型,通常不必指定.mount 会自 ...
- JDK 中的监控与故障处理工具-05 (jstack)
jstack : stack trace for java jstack 命令用于生成虚拟机当前时刻的线程快照 (threaddump).线程快照是当前虚拟机中每一条线程正在执行的方法堆栈的集合,生成 ...
- C# 删除文件以及文件夹
代码如下: /// <summary> /// 删除文件夹以及文件 /// </summary> /// <param name="directoryPath& ...
- P4开源Tutorials教程样例实战及对P4v1.1规范的初分析
Github链接:Github-P4Lang-Tutorials-p4v1.1 前言 本文主要对Barefoot开源教程中的p4v1.1实例simple_router的实战步骤进行记录与阐述,希望能帮 ...
- 06_MySQL DQL_分组查询
# 分组查询/*语法: select 分组函数,列(group by中出现的字段) from 表 [where 筛选条件] group by 分组的列表(单个字段,多个字段,函数,表达式) [havi ...
- ionic serve 第一次可以访问,刷新报错解决方法
想学习一下,在ionic start 新项目后, ionic serve 第一次可以访问是可以的, 可是刷新一下后就报错了,端口也没给占用, 网上找了半天也没找到问题所在, 最后研究了下: npm i ...