Servlet specifications evolved over the period of time. There is lot of improvements has been added to the web deployment descriptor as part of the new versions. It is important for the Java developers to understand the new elements in the web.xml and utilize the added features.

In this tutorial I will summarize the sample snippet from the list of web.xml file used in the previous versions of servlet. Primarily I have listed the XML schema that have updated on different versions of servlet. This will help you to understand the evolution of servlet configuration file and the latest improvements. If you have any questions, please write it in the comments section.
1. Servlet 2.3
This version uses the Document Type Definition (DTD) validation for the web.xml validation. This is the traditional way of validation before the XML schema validation. After the XSD’s introduction, it is not recommended to use DTD.
<!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>Servlet 2.3 Sample Application</display-name> </web-app>
2. Servlet 2.4
First time in Servlet 2.4, XSD is used for the validation of XML contect. This version of the deployment descriptor is used for long time and become most popular.
<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> <display-name>Servlet 2.4 Sample Application</display-name> </web-app>
3. Servlet 2.5
In the version XML namspace changed from J2EE to JavaEE as 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> <display-name>Servlet 2.5 Sample Application</display-name> </web-app>
4. Servlet 3.0
This is the latest major servlet release with lot of advanced features. Not most of the projects are adopted this version. Still most of the projects are using Servlet 2.5 version.
<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 Sample Application</display-name> </web-app>