|
APACHE TOMCAT
6
APACHE TOMCAT 5.5 INTERMEDIATE SERVLETS & JSP ADVANCED SERVLETS & JSP SCWCD JAKARTA STRUTS JAVASERVER FACES (JSF) AJAX & GWT (Google Web Toolkit) Tutorial PROTOTYPE SCRIPTACULOUS JAVA 5 & 6 PROGRAMMING TUTORIALS IN CHINESE TUTORIALS IN JAPANESE
ABOUT THE INSTRUCTOR COURSE REVIEWS JSF & APACHE MYFACES AJAX & GWT (Google Web Toolkit) Training INTERMEDIATE SERVLETS & JSP ADVANCED SERVLETS & JSP SCWCD JAKARTA STRUTS JAVA 5 & 6 PROGRAMMING CUSTOMIZED ON-SITE PUBLIC COURSE SCHEDULE
|
table of contents• Quick Start Guide• Installing Java • Unzipping Tomcat • Setting JAVA_HOME • Setting CLASSPATH • Setting Up Your Development Environment • Testing the Server • Deploying Using Custom Web Applications • Using Tomcat with Eclipse • Using Tomcat with MyEclipse • More Information Configuring & Using Apache Tomcat 6A Tutorial on Installing and Using
|
|||||||||||||
|
Manual Tomcat Execution (Details here) |
Tomcat with Eclipse (Details here) | Tomcat with MyEclipse (Details here) |
|---|---|---|
|
|
|
Overview
This tutorial is a guide to installing and configuring Apache Tomcat 6 for use as a standalone Web server (for development) that supports servlets 2.5 and JSP 2.1. (Note: Apache Tomcat is sometimes referred to as "Jakarta Tomcat" since the Apache Java effort is known as "The Jakarta Project"). This Tomcat tutorial covers version 6.0.16, but the steps are almost the same for any Tomcat 6.0.x version. For coverage of Tomcat 5.5, see the separate Tomcat 5.5 tutorial. For coverage of very old Tomcat versions (Tomcat 5.0.x and Tomcat 4.0.x), please see the Apache Tomcat 5.0 and 4.0 tutorial.
Using Tomcat as a deployment server or integrating Tomcat as a plugin within the regular Apache server or a commercial Web server is more complicated than what is described in this tutorial. Although such integration is valuable for a deployment scenario (see http://tomcat.apache.org/tomcat-6.0-doc/), my goal here is to show how to use Tomcat as a development server on your desktop. Regardless of what deployment server you use, you'll want a standalone server on your desktop to use for development.
The examples here assume you are using Windows, but they can be easily adapted for MacOS, Linux, Solaris, and other versions of Unix. Except when I refer to specific Windows paths (e.g., C:\blah\blah), I use URL-style forward slashes for path separators (e.g., install_dir/webapps/ROOT). Adapt as necessary.
To report errors or omissions in this writeup or to inquire about customized on-site training courses on servlets, JSP, Struts, JSF, Ajax, GWT, Java 5, Java 6, and other Java EE technologies, please contact Marty Hall at hall@coreservlets.com.
Manual Tomcat Execution: Details
Here are more details on using the preconfigured Tomcat version for direct (manual) execution. You can also use Tomcat within Eclipse or MyEclipse, or you can customize the configuration.-
Unzip
Tomcat.
Unzip
tomcat-6.0.16-preconfigured.zip
into the top level of the C drive. This should result in
C:\apache-tomcat-6.0.16\.
This version of Tomcat has the following settings already in place.
For details on customizing this configuration, please
see the detailed
configuration guide.
- The port is changed from 8080 to 80. This
lets you enter URLs
of the form http://localhost/... instead of
http://localhost:8080/....
- When you download Tomcat from the Apache site, the port is 8080 in case you already have another server running on port 80.
- Servlet reloading is enabled. This lets you
deploy a modified
servlet .class file without restarting the server.
- When you download Tomcat from the Apache site, servlet reloading is disabled for performance reasons. You might want it disabled on a server used for a deployed application, but you definitely want it enabled during development.
- The invoker servlet is enabled.
This lets you drop a servlet .class
file into
webapps/appName/WEB-INF/classes/packageName and
immediately run it with a URL of the form
http://localhost/appName/servlet/packageName.servletName.
That is, the invoker servlet saves you from editing web.xml to
give a servlet-mapping to your servlet.
- When you download Tomcat from the Apache site, the invoker servlet is disabled. You definitely want the invoker servlet disabled on a server used for a deployed application, but having it enabled on your development server is very convenient for quick testing.
- Tomcat monitors struts-config.xml and faces-config.xml.
Whenever either of these files changes, Tomcat reloads the Web
application. This saves you from restarting the server when
you change these files.
- If you do not use Struts or JSF, this change will not be beneficial to you. But it does not hurt either way.
- Directory listings are turned on.
If you type a URL ending in / and there is no welcome file,
Tomcat shows a directory listing.
- Directory listings were on by default in previous Tomcat versions. They are not required but are convenient, especially during development.
- The port is changed from 8080 to 80. This
lets you enter URLs
of the form http://localhost/... instead of
http://localhost:8080/....
-
Set
JAVA_HOME. Set this environment variable to point at the top-level of your Java installation directory (e.g., C:\Program Files\Java\jdk1.6.0_10.) For details, see the sample autoexec.bat file or this section of the page on configuring your development environment. -
Set
CLASSPATH. Set this environment variable to include ".", C:\Servlets+JSP, and the servlet/JSP JAR files. For details, see the sample autoexec.bat file or this section of the page on configuring your development environment.
For a very quick test, open C:\Servlets+JSP, double click on the shortcut to startup.bat, and open http://localhost/ in your browser. If you see something about Tomcat, the setup was successful. But be sure to do the more complete server tests to verify that you have your development and deployment environment also set up properly.
More Information
Online documentation
- Servlet 2.5 API. Supported by Tomcat 6.x. However, since 2.5 was a relatively minor release, many developers just follow the servlet 2.4 specification.
- JSP 2.1 API. Supported by Tomcat 6.x. However, since 2.1 was a relatively minor release, many developers just follow the JSP 2.0 specification.
- Servlet 2.4 API. Supported by Tomcat 5.x and 6.x.
- JSP 2.0 API. Supported by Tomcat 5.x and 6.x.
- Beginning/Intermediate Servlet and JSP Tutorials
- Advanced Servlet and JSP Tutorials
- Java SE 6 API
- Java SE 5 API
- Java EE 5 API. Includes the servlet 2.5 and JSP 2.1 APIs.
- Java Programming Tutorials
- Struts Developer and User Guides
- Struts API
- Jakarta Struts Tutorials
- JSF 1.2 Java API
- JSF 1.2 Tag Library API
- JSF 1.1 Java API
- JSF 1.1 Tag Library API
- Apache MyFaces Documentation
- Tutorials on JSF (with Apache MyFaces, Ajax4jsf, Tomahawk, and Facelets)
- Ajax and GWT Tutorials (includes Prototype and Scriptaculous)
The following public
training courses
are available:
Rich Internet Apps
with Ajax and GWT
October 20-24, 2008
Maryland
Web App Development
with Servlets and JSP
October 13-17, 2008
Maryland
Java Programming:
A Crash Course
August 18-22, 2008
October 6-10, 2008
Maryland
Courses at
YOUR Location
• Customizable Content
• Flexible Dates
• Any Country
CEU's Now Available
You can get CEU's
for onsite courses.
Courses can be
offered directly from
accredited college.


