Dynamic Web Pages

A dynamic document is produced by a program that can receive input from a user and modify the Web page based on that input. A typical mechanism for communication between a user's browser and a Web server is called the Common Gateway Interface (CGI). Altogether, the Common Gateway Interface (CGI) is a set of conventions, supported by software, that facilitate the writing of programs that generate World Wide Web documents. CGI programs can be written in almost any programming language; naturally, though, we'll use Java.

With CGI programming, the sequence of events for Web interaction has an extra step:

  1. Within a Web browser, you type a URL.
  2. Your browser sends a request to the server for that address.
  3. The server finds the file on a disk drive.
  4. The server retrieves the file from the disk and notes that the file identifies a program to run.
  5. The server runs the program, which produces an HTML document.
  6. The server sends the newly-produced HTML document back to your browser.
  7. Your browser interprets the file and displays it on your screen.
This sequence of events is illustrated in the following diagram.

Client-server interaction for the World-Wide Web - 2