Home TOC |
![]() ![]() ![]() |
Web Application Archives
If you want to distribute a Web application and run it on another server you package it in a Web application archive (WAR), which is a JAR similar to the package used for Java class libraries, and installed (or deployed) into a Web container. In addition to Web components, a Web application archive usually contains other files including:
- Server-side utility classes (database beans, shopping carts, and so on). Often these classes conform to the JavaBeans component architecture.
- Static Web content (HTML, image, and sound files, and so on)
- Client-side classes (applets and utility classes)
Web components and static Web content files are called Web resources.
A WAR has a specific directory structure. The top-level directory of a WAR is the document root of the application. The document root is where JSP pages, client-side classes and archives, and static Web resources are stored.
The document root contains a subdirectory called
WEB-INF
, which contains the following files and directories:
web.xml -
the Web application deployment descriptor- Tag library descriptor files (see Tag Library Descriptors (page 471)).
classes
- a directory that contains server-side classes: servlets, utility classes, and JavaBeans components.lib
- a directory that contains JAR archives of libraries (tag libraries and any utility libraries called by server-side classes).You can also create application-specific subdirectories (that is, package directories) in either the document root or the
WEB-INF/classes
directory.The ant build files distributed with the tutorial examples construct this directory structure in the
build
subdirectory.Creating a WAR File
Home TOC |
![]() ![]() ![]() |