Introduction


Servlets are Java technology's answer to Common Gateway Interface (CGI) programming. They are programs that run on a web server, acting as a middle layer between a request coming from a web browser or other HTTP client and databases or applications on the HTTP server. Their job is to perform the following tasks, as illustrated in Figure 2-1.
Figure 2-1 the role of Web middleware

In the next several pages we are going to discuss the following points:
What is Servlet?
Getting started with Servlet.
How Servlet works?
Basic Servlet Design.
Servlet Lifecycle.