Documents available on the Web are usually prepared and set in advance to supply some fixed content, either in HTML or in some other format such as plain text, GIF, or JPEG. These fixed documents are static. A Web server can also generate documents on-the-fly that bring these and other advantages:

• customizing a document depending on when, where, who, and what program is retriev- ing it
• collecting user input (with HTML forms) and providing responses to the incoming information

• enforcing certain policies for outgoing documents • supplying contents such as game scores and stock quotes, that are changing by nature.

Dynamical Web pages are no magic. Instead of retrieving a fixed file, a Web server simply calls another program to compute the document to be returned. As you may have guessed, not every program can be used by a Web server in this manner. There are two ways to add server-side programming:

• Loading programs directly into the Web server to be used whenever the need arises.
• Calling an external program from the server passing arguments to it and receiving re- sults thus generated. Such a program must conform to the Common Gateway Interface (CGI) specifications governing how the Web server and the external program interact.

Dynamic Server Pages
Dynamic generation of pages is made simpler and more integrated with Web page design and construction by allowing a Web page to contain active parts that are treated by the Web server and transformed into desired content on-the-fly as the page is retrieved and returned to a client browser.
The active parts in a page are written in some kind of notation to distinguish them from the static parts of a page. The ASP (Active Server Page from Microsoft), JSP (Java Server Page), and the popular PHP (Hypertext Preprocessor) are examples.

Because active pages are treated by modules loaded into the Web server, the processing is faster and more efficient as compared to CGI programs. Active pages also provide form processing, HTTP sessions, as well as easy access to databases and, therefore, offer complete server-side support for dynamic Web pages.

Both CGI and server pages can be used to support HTML forms (Chapter 8), the familiar fill-out forms you often see on the Web.

1.14 HTTP Briefly
On the Web, browser-server communication follows the HTTP protocol. It is good for a Web developer to have a basic understanding of HTTP. Here is the framework of an HTTP transaction:
1. Connection—A browser (client) opens a connection to a server.
2. Query—The client requests a resource controlled by the server.
3. Processing—The server receives and processes the request.
4. Response—The server sends the requested resource back to the client.
5. Termination—The transaction is done and the connection is closed unless another transaction will take place immediately between the client and server.

HTTP governs the format of the query and response messages The header part is textual and each line in the header should end in return and newline but it may end in just newline. The initial line identifies the message as a query or a response:
• A query line has three parts, separated by spaces: a query method name, a local path of the
initial line (different for query and response) HeaderKey1: value1

The GET method simply request the specified resource and does not allow a message body. A GET method can invoke a server-side program by specifying the CGI or active- page path, a question mark (?), then a query string:

GET /cgi-bin/newaddr?name=value1&email=value2 HTTP/1.0 Unlike GET, the POST method allows a message body and is designed to work with
HTML forms.

A response (or status) line also has three parts separated by spaces: an HTTP version number, a status code, and a textual description of the status. Typical status lines are:

HTTP/1.0 200 OK
404 Not Found

when the requested resource cannot be found.
The HTTP response sends the requested file together with its content type (Section 1.5) and length (optional) so the client will know how to process it.
The HTTP response sends the requested file together with its content type (Section 1.5) and length (optional) so the client will know how to process it.

The Web is a versatile and all-encompassing distributed information system. Web servers and clients use the HTTP protocol which is based on TCP/IP.
On the Web resources are identified by URLs. The host part of the URL identifies a host computer either by it IP address or by its domain name.

Web pages are usually written in HTML that can markup text and supply hyperlinks using partial and full URLs. Web pages are places under Web servers and become available on the Web. Commercial hosting companies provide hosts and servers to serve Web pages online.
Generating simple Web pages is very easy.
It takes technical understanding, talent, and team work to build websites. The most central are design and programming.