Java Reference
In-Depth Information
Web Applications
The release of the Java Servlet Specification 2.2 introduced the concept of a Web application.
According to this specification a Web application is a collection of servlets, HTML pages,
classes, and other resources that can be bundled and run on multiple containers from multiple
vendors. In this topic you create the Web application directory structure and create a new appli-
cation entry in the server.xml file. (Because you develop your examples as you progress
through the topic, you don't deploy the examples into a Web ARchive (WAR) file; however we
do discuss WAR files.) The following is a list of items that can exist in a Web application:
JavaServer Pages
Utility classes
Static documents including HTML and images
Client-side classes
Meta information that describes the Web application
The ServletContext in Relation to the Web Application
Each Web application belongs to one and only one ServletContext . This mapping is con-
trolled by the servlet container, and guarantees that no two applications will have clashes when
storing objects in the ServletContext .
The Directory Structure
The container that holds the Web application is the directory structure in which it exists. The
first step in creating a Web application is to create this structure. Table A.1 contains sample
directories you will need. Each one of these directories should be created from the
<SERVER_ROOT> of the servlet container.
The Web Application Directories Structure
This is the root directory of the Web applica-
tion. This is where we will be installing all of
our JSPs and HTML files.
/ applicationname
Search WWH ::

Custom Search