Java - Web Application (Web Module) - War

> Procedural Languages > Java

1 - 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.

Advertising

3 - Format

3.1 - 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 create

3.2 - Content

The war file is a hierarchical set of folders with:

  • Java classes and jar files
  • static files, (HTML, JavaScript, image, files and resources)
  • directories,
  • web component (servlet class files, jsp, jsf) for the front end / presentation layer
  • JavaBeans for the business logic layer
  • ressource, such as image files
  • An application configuration resource file, which configures application resources
  • An set of tag library descriptor files (for Jsf Application)
Advertising

3.3 - Deployment Descriptor

XML Deployment Descriptors

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

  • WebLogic - WEB-INF/weblogic.xml

See Java - Deployment descriptors (Metadata)

3.4 - Files

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

  • WEB-INF/lib,
  • WEB-INF/classes
  • or WEB-INF directories

4 - 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
Advertising

5 - Management

5.1 - create

Zie create

jar cvf myWar.war myApp
lang/java/web_application.txt · Last modified: 2019/04/26 17:35 by gerardnico