Developing Applications with Tomcat


Installing Tomcat
Deployment Organization
Source Organization
The Actual Development Process
Integrating a Sample Application with Tomcat


Installation

Tomcat will operate under any Java Development Kit (JDK) environment that provides a JDK 1.1 or JDK 1.2 compatible platform. The JDK is required so that your servlets, other classes, and JSP pages can be compiled.

Once you have downloaded the required file, unzip it to a directory of your choice. (In the Microsoft Lab 5 at UWI the file is extracted directly to the C drive (C:\) ). A sub-directory named jakarta-tomcat is created and this is the root directory of the tomcat hierarchy.

This sub-directory should contain the following directories as highlighted in the table below. A description of the directories is also given.

Directory name Description
bin Contains the startup, shutdown, tomcat, ... scripts. These scripts are used to start and shutdown the server and also set the classpath and other environment variables.
conf Contains various configuration files including server.xml (Tomcat's main configuration file) and web.xml that sets the default values for the various web applications deployed in Tomcat.
doc Contains miscellaneous documents regarding Tomcat.
lib Contains various jar files that are used by Tomcat. On UNIX any file in this directory is appended to Tomcat's classpath.
logs This is where Tomcat places it's log files.
src The servlet APIs source files. Don't get excited, though; these are only the empty interfaces and abstract classes that should be implemented by any servlet container.
webapps This is where we place our web applications. Usually contains sub-directories and the names usually indicates the respective web applications that are placed in the directory.

The following directories may also be present in the root directory of our Tomcat hierarchy structure:

work Automatically generated by Tomcat, this is where Tomcat places intermediate files (such as compiled JSP files) during it's work. If you delete this directory while Tomcat is running you will not be able to execute JSP pages.
classes You can create this directory to add additional classes to the classpath. Any class that you add to this directory will find it's place in Tomcat's classpath.

For a detailed review of the scripts and configuration files provided with Tomcat please take a look at the uguide\tomcat_ug.html file located in the doc directory.

Previous    Next