René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

JAVA Web Application

A (JAVA) Web Application is a collection of dynamic (servlets, JSP, static content (for example HTML pages or gif/jpg files)) and static (.html, .jpg...) resources. These resources are commonly referred to as web components.

Layout of a Web Application

These files are stored in a standard layout hierarchy of directories. Such a hiearchy is either in unpacked form or packed form.

Unpacked form

The files are seperately stored in the file system. This form is more useful while developing.

Packed form

After a web application has been developped, it will be packed (with jar). The files are then stored in a .war (Web Archive) file.
All servlets, classes, static files, and other resources belonging to a Web Application are organized under a directory hierarchy. The root of this directory is called document root.

The directory structure

The *.html, *.jsp, *.gif, *.jpg (that is the static web components) files go to the top level directory. These are the files that somehow can be retrieved by the client.
The Web Application Deployment Descriptor: is an XML file (named web.xml) that goes under /WEB-INF
/WEB-INF/classes: this directory contains the (compiled) java classes that are required for the application.
If the classes are organized into packages, the package names are subdirectores under /classes.
/WEB-INF/lib: Contains .jar files that are required for the application. These classes include JSP tag libraries.
This tree must be found under <WebServerHome>/webapps
<webapp-root>
   foo.gif
   bar.html
   /WEB-INF
      web.xml
      /classes
         servlet_1.class
         servlet_2.class
      /lib
         foo.jar