Chapter 18. WAR Packaging

This chapter is for the Web component provider; that is, the person in charge of developing the web components on the server side. It describes how the web components should be packaged.

18.1. Principles

Web components are packaged for deployment in a standard Java programming language Archive file called a war file (Web ARchive), which is a jar similar to the package used for Java class libraries. A war has a specific hierarchical 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:

18.1.1. Example

Before building a war file, the Java source files must be compiled to obtain the class files (located in the WEB-INF/classes directory) and the two XML deployment descriptors must be written.

Then, the war file (web-application.war) is built using the jar command:

cd your_webapp_directory
jar cvf web-application.war *

During the development process, an "unpacked version" of the war file can be used. Refer to Section 3.5.3 Configuring the WEB Container Service.