A servlet is a small program that runs on a server.
The term was coined in the context of the Java applet, a small program
that is sent as a separate file along with a Web (HTML) page. Java applets,
usually intended for running on a client, can result in such services
as performing a calculation for a user or positioning an image based on
user interaction.
Some programs, often those that access databases based on user input,
need to be on the server. Typically, these have been implemented using
a Common Gateway Interface (CGI) application. However, with a Java running
in the server, such programs can be implemented with the Java programming
language. The advantage of a Java servlet on servers with lots of traffic
is that they can execute more quickly than CGI applications. Rather than
causing a separate program process to be created, each user request is
invoked as a thread in a single daemon process, meaning that the amount
of system overhead for each request is slight.
|