The web.xml
is a configuration file to describe how a web application should be deployed. Here’re 5 web.xml
examples, just for self-reference.
1. Servlet 3.1 deployment descriptor
Java EE 7 XML schema, namespace is http://xmlns.jcp.org/xml/ns/javaee/
web.xml
注:maven依赖为:
javax.servlet javax.servlet-api 3.1.0
2. Servlet 3.0 deployment descriptor
Java EE 6 XML schema, namespace is http://java.sun.com/xml/ns/javaee
web.xml
3. Servlet 2.5 deployment descriptor
Java EE 5 XML schema, namespace is http://java.sun.com/xml/ns/javaee
web.xml
4. Servlet 2.4 deployment descriptor
J2EE 1.4 XML schema, namespace is http://java.sun.com/xml/ns/j2ee
web.xml
Servlet 2.4 Web Application
5. Servlet 2.3 deployment descriptor
J2EE 1.3 DTDs schema. This web.xml
file is too old, highly recommend you to upgrade it.
web.xml
Servlet 2.3 Web Application