Another major way of deploying a web application into Tomcat is to deploy the application packed into a WAR file. WAR files are described in detail in the Java Servlet Specification.
With Tomcat, when you deploy your WAR file, you must decide whether to serve your webapp after unpacking the WAR file or while it is still packed into a WAR file. Both ways are supported. By default, when Tomcat deploys a WAR file, the first thing it does is unpack the contents of the WAR file into a directory of the same name minus the .war extension, and then serves the files from the unpacked directory.
For example, if your WAR file is named
Tomcat would unpack the contents of
suitcase.war into a
suitcase, and then the files that are
served as part of the webapp will be read from the
suitcase directory on disk, not from the WAR file. You may turn off the
automatic unpacking behavior by setting
unpackWARs="false" on your
Host element in
server.xml. With it set to
Tomcat will serve your webapp's files right from the packed WAR file itself.
There are two ways to configure Tomcat to recognize and start your web application when you first deploy it as a WAR file:
<Context> element to the
server.xml file and restart Tomcat.
Add a new context XML fragment file in Tomcat's
directory tree, or create it as your web application's