Common Gateway Interfacesssss 4
Common Gateway Interface – Output
sssssThe total purpose of CGI is to execute a CGI program at theserver site and send the output to the client. The output is usuallyplain text or a text with HTML structures. The output can also be graphics or binary data, a status code, instructions to the browser tocache the results, or instructions to the serve to send an existingdocument instead of the actual output (Forouzan, 2007).
sssssA CGI program creates headers, this is a method used to informthe client about the type of document that is being sent. The outputof a CGI program always contains two components, a header and a body. The header is created first, followed by a blank line then thebody. Although the header and the blank line are not visible on thebrowser screen, the header interprets the body (Forouzan, 2007).
Scripting Technologies for Dynamic Documents
sssssThe chief disadvantage of CGI is that the program mustgenerate an entire HTML page, even if only a few lines differ foreach generation. Dynamic document technologies, integrated with the server software, exist to handle the situation where only a smallportion of the page changes. The page contains a mixture of HTMLand scripting information; HTML is passed through unchanged, andthe scripting information is interpreted to generate dynamic content.Several server-side scripting technologies exist.
- Active Server Pages (ASP), a Microsoft product uses thescripting 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).