O'Reilly logo

Java Examples in a Nutshell, 3rd Edition by David Flanagan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Servlet Setup

In order to run the examples in this chapter, you need the following:

  • A web server to host the examples.

  • A servlet container, or servlet engine, which the web server uses to run the servlets. In order to run the JSP examples, your servlet container must also support JSP pages. Note that most of the JSP examples in this chapter rely on the new features of JSP 2.0. Servlet containers sometimes invert the architecture and include a web server.

  • An implementation of the Java Standard Tag Library, so that the JSP examples that use those tag libraries can run correctly.

  • The class files for the servlet API, so you can compile servlet classes.

  • A deployment descriptor that tells your servlet container how to map URLs to servlet classes.

This list looks more daunting than it actually is, as you'll see in the sections that follow.

The Servlet Container

Just as there are many web servers available, there are numerous servlet containers to choose from. I use and recommend Tomcat, an open source product of the Jakarta project. Jakarta is itself a project of the Apache Software Foundation, the organization that produces the open source Apache web server. Tomcat has benefited from substantial contributions by Sun, and the official reference implementations for Sun's Servlet and JSP specifications are built upon the Tomcat codebase. The core of Tomcat is a servlet and JSP container that can be used with the Apache web server, as well as with various commercial web servers. For servlet ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required