Three Web server techniques can be used to generate dynamic responses:
Write a CGI program.
Extend the Web server through its API.
Redirect Web server requests to a separate application system, usually through a prebuilt redirection module or script.
For the last option, I use the term separate because this option usually implies that the application system technology exists beyond the process boundary of the Web server and is treated by it as a black box. One example is Java servlets, the main topic of this chapter. Before we explain what servlets are, however, we need to justify their use in comparison to these other alternatives.
Common Gateway Interface (CGI) programs reside on the server ...