Just said last week that the company's project of Web. XML was unified, and by the way, the next version of the standard servlet version corresponding to each tomcat, as follows:
The XSD version is preferred since JSP 2.0/servlets 2.4 (Eg:tomcat 5.5). Note that the XML encoding can is specified as Iso-8859-1, UTF-8, or any other valid encoding in either version, and Shoul D match the actual encoding of your text file.
Note the changes in XSI after servlet 2.4 and 3.1.
Servlet 3.1 Deployment Descriptor
<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>
XSD Example for JSP 2.2/servlets 3.0 (Tomcat 7.0):
<?xml version= "1.0" encoding= "iso-8859-1"? ><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>
XSD Example for JSP 2.1/servlets 2.5 (Tomcat 6.0):
<?xml version= "1.0" encoding= "iso-8859-1"? ><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/javaee http ://java.sun.com/xml/ns/javaee/web-app_2_5.xsd " version=" 2.5 "></web-app>
XSD Example for JSP 2.0/servlets 2.4 (Tomcat 5.5):
<?xml version= "1.0" encoding= "iso-8859-1"? ><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>
DTD Example for JSP 1.2/servlets 2.3 (Tomcat 5):
<?xml version= "1.0" encoding= "iso-8859-1"?> <! 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></web-app>
Official reference visible http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/index.html.
For spring, the corresponding relationship is as follows:
- 4.0 Minimum Requirements JDK 6, support WebSocket, Servlet 3.0+
- 3.0 Minimum Requirements JDK 1.5, annotation-based configuration, servlet 2.4, full support for rest, package split from Spring.jar into modules
- 2.5 Minimum requirements JDK 1.4.2,servlet 2.3, JSP 1.2
Tomcat 5.5, 6, 7 versions of the Web-app standard