1. Version 2.3
Version 2.3
"-//sun Microsystems, INC.//DTD Web application 2.3//en" "http://java.sun.com/dtd/web-app_2_3.dtd" ><web-app> <display-name>servlet 2.3 Web application</display-name></web-app>
This has one drawback :
" Web-app" must Match "(icon?,display-name?,description?,distributable?,context-param*,filter*, Filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?, error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*, env-entry*,ejb-ref*,ejb-local-ref*) ". Eoso/webroot/web-inf
It means that the labels in the Web-app are in a certain order .
<! 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> <display-name>Archetype Created Web Application</display-name> <!--servlet--> <servlet> <servlet-name>Loginservlet</servlet-name> <servlet-class>Com.qunar.fresh.servlet.LoginServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Loginservlet</servlet-name> <url-pattern>/login.do</url-pattern> </servlet-mapping> <servlet> <servlet-name>Accessservlet</servlet-name> <servlet-class>Com.qunar.fresh.servlet.AccessServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Accessservlet</servlet-name> <url-pattern>/a/*</url-pattern> </servlet-mapping></web-app>
To be changed to:
<! 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> <display-name>Archetype Created Web Application</display-name> <!--servlet--> <servlet> <servlet-name>Loginservlet</servlet-name> <servlet-class>Com.qunar.fresh.servlet.LoginServlet</servlet-class> </servlet> <servlet> <servlet-name>Accessservlet</servlet-name> <servlet-class>Com.qunar.fresh.servlet.AccessServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Loginservlet</servlet-name> <url-pattern>/login.do</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>Accessservlet</servlet-name> <url-pattern>/a/*</url-pattern> </servlet-mapping></web-app>
2. Version 2.4
version 2.4
<web-app version="2.4"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/J2EEhttp//java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ">
The above issues can be resolved with more than 2.4 versions.
However, there is a problem with versions 2.4 and below: (multiple URLs cannot be mapped to the same servlet)
<servlet-mapping> <servlet-name>Mvc-dispatcher</servlet-name> <url-pattern>/index</url-pattern> <url-pattern>/login</url-pattern> </servlet-mapping>
3. Version 2.5
<web-app xmlns= "http://java.sun.com/xml/ns/ Java ee " 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 ";
2.5 or later resolves a problem where multiple URLs cannot be mapped to the same servlet.
4. Version 3.0
<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> <display-name>Servlet 3.0 WEB Application</display-name></web-app>
SERVLET3.0 is released with J2ee6, and the Web. XML configuration file contains: Default page configuration, session timeout configuration, and Error prompt page configuration.
<?xml version="1.0" encoding="UTF-8"?><web-app version="3.0"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" ><session-config> <session-timeout>30</session-timeout> </session-config> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <error-page> <error-code>404</error-code> <location>/404.jsp</location> </error-page> <error-page> <error-code>500</error-code> <location>/500.jsp</location> </error-page></web-app>
[Spring Combat Series] () differences between different versions of servlet