Servlets are Java classes that run on servers. In this article, the first of three parts, you will learn how to create, save and compile a servlet. This article is excerpted from chapter five of the book Murach's Java Servlets and JSP, written by Andrea Steelman and Joel Murach (Murach; ISBN: 1890774189).
In this topic, you'll see how the Email List application that was presented in the last chapter works when it uses a servlet instead of a JSP. Once you get the general idea of how this works, youíll be ready to learn the specific skills that you need for developing servlets.
The user interface for the application
Figure 5-1 shows the two pages that make up the user interface for the Email List application. These pages are the same as the pages that are shown in the last chapter except that the second page uses a servlet instead of a JSP.
Like the last chapter, the first page is an HTML page that asks the user to enter a first name, last name, and email address. However, when the user clicks on the Submit button for this application, the HTML page calls a servlet instead of a JSP and passes the three user entries to the servlet. This is shown by the URL thatís displayed in the browser for the second page.
The HTML page
The servlet page
Figure 5-1. The user interface for the application