Tuesday, May 12, 2009

Common Gateway Interfacesssss 4

Common Gateway Interface – Output

sssssThe total purpose of CGI is to execute a CGI program at the

server site and send the output to the client. The output is usually

plain text or a text with HTML structures. The output can also be

graphics or binary data, a status code, instructions to the browser to

cache the results, or instructions to the serve to send an existing

document instead of the actual output (Forouzan, 2007).

sssssA CGI program creates headers, this is a method used to inform

the client about the type of document that is being sent. The output

of a CGI program always contains two components, a header and a

body. The header is created first, followed by a blank line then the

body. Although the header and the blank line are not visible on the

browser screen, the header interprets the body (Forouzan, 2007).

Scripting Technologies for Dynamic Documents

sssssThe chief disadvantage of CGI is that the program must

generate an entire HTML page, even if only a few lines differ for

each generation. Dynamic document technologies, integrated with

the server software, exist to handle the situation where only a small

portion of the page changes. The page contains a mixture of HTML

and scripting information; HTML is passed through unchanged, and

the scripting information is interpreted to generate dynamic content.

Several server-side scripting technologies exist.
  • Active Server Pages (ASP), a Microsoft product uses the

    scripting information written in Visual Basic.

  • Java Server Pages (JSP), uses the Java language for scripting.

  • Hypertext Preprocessor (PHP), uses the Perl language.

  • ColdFusion, embeds SQL database queries in the HTML

    document. (Forouzan, 2007).