The
webapps directory contains web applications.
The idea is that you can group all related files under specific directory,
and then "mount" this directory under Web server and access these files
with the URI which is the webapp directory name. The web application should
be essentially self contained, and should not depend on some external files
or paramers. It should also be easy to "deploy", i.e., install.
Servlet spec 2.2 introduced the concept of Web application and the WAR file
(Web application ARchive). The WAR file is a JAR file which contains all
files needed to provide Web content within this application. In fact,
you do not even have to unpack the WAR file, but it is enough to place it
under
webapps directory, and TOMCAT will find it
and unpack it. Web application has files which are accessible to the
public via server, and files which are not served by the TOMACT server
directly (files under
WEB-INF directory).
There are following files/directories
under
WEB-INF:
- web.xml -- Web application deployment descriptor.
It is an XML file which contains all the parameters and information needed to
run and customize web application.
- classes -- Classes which are seen only by this
Web application. You will also put your compiled servlets here.
- lib -- JAR files go here. These JARs can contain
JavaBeans, Servlets, Utility classes, etc. The classes in these JAR files
are only seen within this application.