The JavaTM Tutorial
Previous Page Trail Contents Next Page Start of Tutorial Search
Feedback Form

Trail: Servlets

by Cynthia Bloch and Stephanie Bodoff

The Servlets trail teaches you about servlets, the bodies of code that run inside servers, and extend their functionality. For example, servlets offer an efficient platform-independent replacement for CGI scripts. Servers that can host servlets are Java-enabled servers that respond to client requests.

Overview of Servlets tells you what servlets are, and how you can use them. The lesson also introduces the example servlets used in this trail.

Client Interaction shows you how to write servlets that interact with clients. The servlets in this lesson respond to HTTP GET, HEAD and POST requests. The lesson also discusses threading issues, and shows you how to avoid problems by creating a servlet that responds to one client at a time.

The Life Cycle of a Servlet discusses the significant events in the life of a servlet and shows you how to customize servlet initialization and shutdown.

Saving Client State shows you how to use session tracking and cookies.

Servlet Communication shows you how to have your servlet communicate with other servlets and other resources, such as CGI scripts.

Running Servlets describes how to test your servlets with Tomcat and the Java Servlet Development Kit (JSDK) version 2.1.

Calling Servlets shows you how to call servlets from a browser and within an HTML page.


Note:  Java Servlet technology is a standard extension to the Java 2 Platform, Standard Edition. The Tomcat 3.x and 4.0 implementations support the 2.2 and 2.3 versions of Java Servlet technology. You can download Tomcat from http://java.sun.com/products/servlet/download.html(outside of the tutorial) The JSDK supports the 2.1 version of Java Servlet technology. The JSDK is available from http://java.sun.com/products/servlet/archive.html(outside of the tutorial) The following lessons apply to both Tomcat and the JSDK version 2.1.

Note to Enterprise Users: The Java Servlet Technology chapter(outside of the tutorial) in The J2EE Tutorial is geared to deploying servlets on the Java 2 Enterprise Edition (J2EE) SDK version 1.3. The bookstore application in this trail has been adapted to use the Cloudscape database distributed with the J2EE SDK. The J2EE chapter also discusses API introduced in the Servlet Specification v 2.3.

Previous Page Trail Contents Next Page Start of Tutorial Search
Feedback Form

Copyright 1995-2002 Sun Microsystems, Inc. All rights reserved.