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.
Articles Related
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:
- 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)
Deployment Descriptor
XML Deployment Descriptors
- J2EE (Default mandatory) - WEB-INF/web.xml
And a web app server descriptor to at minimum defined the context root
- WebLogic - WEB-INF/weblogic.xml
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
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