Application developers need to know what extensions are installed on a Web container, and containers need to know what dependencies servlets in a WAR have
on such libraries in order to preserve portability.
The application developer depending on such an extension or extensions must provide a META-INF/MANIFEST.MF entry in the WAR file listing all extensions needed by the WAR. The format of the manifest entry should follow standard JAR manifest format. During deployment of the Web application, the Web container must make the correct versions of the extensions available to the application following the rules defined by the Optional Package Versioning mechanism (http://java.sun.com/j2se/1.4/docs/guide/extensions/).
Web containers must also be able to recognize declared dependencies expressed in the manifest entry of any of the library JARs under the WEB-INF/lib entry in a WAR. If a Web container is not able to satisfy the dependencies declared in this manner, it should reject the application with an informative error message.
The value of this attribute specifies the relative URLs of the extensions or libraries that this application or extension needs. URLs are separated by one or more spaces. The application or extension class loader uses the value of this attribute to construct its internal search path.
What matters to us here is what’s required by the spec, and the answer is—it makes almost no difference whether the app is deployed in or out of a WAR! In other words, you still need WEB-INF, web.xml, etc. [...]
There is one thing you can do when you use a WAR file that you can’t do when you deploy without one—declare library dependencies.
In a WAR file, you can declare library dependencies in the META-INF/MANIFEST.MF file, which gives you a deploy-time check for whether the Container can find the packages and classes your app depends on. That means you don’t have to wait until a resource is requested before the whole thing blows up because the Container doesn’t have a particular class in its classpath that the requested resource needs.