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 ...
Get Java Examples in a Nutshell, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.