- Java Servlet Technology
- The Tomcat Servlet Container
- Six Steps to Running Your First Servlet
- About This Article
The Tomcat Servlet Container
Many different servlet containers are available today. The most popular one, which is recognized as the official servlet/JSP container, is Tomcat. Originally designed by Sun Microsystems, Tomcat source code was handed over to the Apache Software Foundation in October 1999. In this new home, Tomcat was included as part of the Jakarta Project, one of the projects of the Apache Software Foundation. Working through the Apache process, Apache, Sun, and other companieswith the help of volunteer programmers worldwideturned Tomcat into a world-class servlet reference implementation. Two months after the handover, Tomcat version 3.0 was released. Tomcat went through several 3.x releases until version 3.3.
The successor of version 3.3 is the current version, version 4.0. The 4.0 servlet container (Catalina) is based on a completely new architecture and has been developed from the ground up for flexibility and performance. Version 4.0 implements the Servlet 2.3 and JSP 1.2 specifications. This is the version used in this book.
Tomcat itself is a web server. This means that you can use Tomcat to service HTTP requests for servlets as well as static files (HTML, image files, etc). In practice, however, Tomcat normally is used as a module with another more robust web server, such as Apache Web server or Microsoft Internet Information Server. All non-servlet, non-JSP requests are faster if they also are served by one of these more robust servers. Only requests for servlets or JSP pages are passed to Tomcat.
To write a servlet, you need at least version 1.2 of the Java Development Kit. If you have not already done so, you can download JDK 1.2 from http://java.sun.com/j2se. The reference implementation for both servlets and JSP are not included in the J2SE, but they are available in Tomcat. Tomcat itself is written purely in Java.
Tomcat installation and configuration are discussed in Appendix A, "Tomcat Installation and Configuration." If you haven't done so, take the time to install and configure Tomcat before continuing on with the rest of this article. The directory where Tomcat is installed is often referred to as %CATALING_HOME%.