3.2 Introduction to Web Application Development with Tomcat
The Apache Software Foundation has published an excellent guide on application development
under Tomcat at
. The author
strongly recommends basing a new development environment on the instructions provided by
this document. This Section provides a brief summary of the key ideas of Apache's application
development guide, some additional comments for clarification, and a detailed example for
creating a simple application, which can serve as a starting point for more complex tasks.
Important note: Depending on your user account settings on the system you are using, you
might need to have Linux super user (administrator) rights to write to directories that are not
inside your local user home directory. You may also require logging in as a super user to
configure the Tomcat servlet engine, or to start and stop it during development. If you are not
familiar with the access rights and user management on your Linux system, please contact your
system administrator. The system administrator may also wish to grant you the required
permissions explicitly by providing the appropriate sudo commands.
3.2.1 Creating the Source Code Repository
The source code should be kept separate from the compiled version of the application. Source
code control is easier if the directories contain only source files, and it is much more convenient
to make an installable distribution of the application. The Apache Software Foundation
recommends a directory hierarchy for source files, which is shown in Figure 5.
Using the recommended directory structure also has the advantage that a provided build script
may be used without major modifications, which can create a compiled Web application from
the source tree with just one shell command.
Before creating the source repository with the Concurrent Versions System, CVS needs to be
configured according to the access levels required. CVS repositories can be configured for
single users, user groups on the same server, or for multiple users on many client machines
using remote access over a network or the Internet. Described here is the configuration for a
user group accessing the repository from a single server. Please see Section 3.2.5 for
references on how to set up CVS for the other cases.