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工程必须的. ...
随机推荐
- elasticsearch 5.5.1 head插件安装
5.5.1版本与之前版本有很大不同. 1. 下载插件 git clone git://github.com/mobz/elasticsearch-head.git 2. 编译 cd elasticse ...
- [BZOJ1058]报表统计
Description 小Q的妈妈是一个出纳,经常需要做一些统计报表的工作.今天是妈妈的生日,小Q希望可以帮妈妈分担一些工 作,作为她的生日礼物之一.经过仔细观察,小Q发现统计一张报表实际上是维护一个 ...
- Linux 下部署Django项目
Linux 下部署Django项目 说明:本文所使用的环境为CentOS 6+Python2.7+Django1.11 安装Django.Nginx和uWSGI 1.确定已经安装了2.7版本的Py ...
- CentOS7下安装VLC
用最新的CentOS7发现没有视频播放器,于是在http://pkgs.org/上查找,发现了nux dextop仓库上有,于是到他的官网上http://li.nux.ro/repos.html查了下 ...
- nagios配置邮件报警
1.配置sendmail vi /etc/mail.rc 加入以下行 set bsdcompat set from=邮件用户名@domain.com smtp=smtp.126.com set smt ...
- Python基础笔记系列八:字符串的运算和相关函数
本系列教程供个人学习笔记使用,如果您要浏览可能需要其它编程语言基础(如C语言),why?因为我写得烂啊,只有我自己看得懂!! 字符串的运算1.字符串的加法和乘法 python中不但支持字符串相加,还支 ...
- 【转发】Linux中设置服务自启动的三种方式
有时候我们需要Linux系统在开机的时候自动加载某些脚本或系统服务 主要用三种方式进行这一操作: ln -s 在/etc/rc.d/rc*.d目录中建立/e ...
- 利用Java.util.UUID来生成唯一ID(用来做数据库主键好用)
UUID(Universally Unique Identifier)全局唯一标识符,是指在一台机器上生成的数字,它保证对在同一时空中的所有机器都是唯一的.按照开放软件基金会(OSF)制定的标准计算, ...
- 工作流引擎Activiti使用总结(转)
1.简单介工作流引擎与Activiti 对于工作流引擎的解释请参考百度百科:工作流引擎 1.1 我与工作流引擎 在第一家公司工作的时候主要任务就是开发OA系统,当然基本都是有工作流的支持,不过当时使用 ...
- ubuntu 16.04网速监控脚本
#!/bin/bashif [ $# -ne 1 ];thendev="enp2s0"elsedev=$1fi while :doRX1=`/sbin/ifconfig $dev ...