Table of Contents

Java - Web Application (Web Module) - War

About

Web application in Java.

A Java web application serve and/or generates interactive HTML web pages.

An enterprise application may contain zero or more web applications.

Format

War

A web application is generally deliverd as a war file (Web Archive). It's JAR files renamed to a .war (web archive) extension.

The deployment unit is an archive file containing all files.

Archive files are typically created by using the jar utility or Ant's jar tool. See Java - Packaging, Archive, Library (JAR, WAR, EAR File)

Content

The war file is a hierarchical set of folders with:

Deployment Descriptor

XML Deployment Descriptors

And a web app server descriptor to at minimum defined the context root

See Java - Deployment descriptors (Metadata)

Files

A War is a special JAR file with special treatment for files that should end up in the :

Example

For example, a Java Server Faces web application WAR file using Facelets typically has the following directory structure:

myWebApp/
  WEB-INF/
    web.xml
    weblogic.xml
    lib/
      MyLib.jar
    classes/
      MyPackage/
        MyServlet.class
  index.html
  index.jsp

Management

create

Zie Java - Packaging, Archive, Library (JAR, WAR, EAR File)

jar cvf myWar.war myApp