Docsity

Dynamic Web Document Technologies, (CGI, ASP, JSP, PHP, ColdFusion) | EE 432, Study notes of Computer Systems Networking and Telecommunications

Toggle sidebar
bg1
1
Dynamic Web Document
Technologies, (CGI, ASP, JSP, PHP,
ColdFusion)
Chapter 36
Types of Web Documents
•Static
–Server had flat file with HTML.
–Browser displays HTML.
•Dynamic
–Server runs a program to generate HTML on the fly.
–Browser displays HTML.
•Active
–Server sends code to the browser imbedded in
HTML.
–Browser executes code locally to produce an
interactive display.
Static Web Document
•Advantages
–Simplicity
–Reliability
–Performance
–Browser can display a
static page rapidly.
–Local machine can cache
the document to speed
future requests.
•Disadvantages
–Inflexibility
–The document must be
revised by hand.
–Not useful for reporting
information that changes
frequently.
Dynamic Web Document
•Advantages
–Can be used to report
current information:
•Stock prices
•Weather conditions
•Ticket availability
–Responsibility for the
information is placed on
the server.
–To the browser, it looks
just like a static page.
•Disadvantages
–Increased cost of
producing a web page
because code must reside
on the server.
–More testing is required.
–Faster server is needed.
–Still cannot display
animated information on
the browser.
–Not a good choice for
displaying clock
synchronized to NIST.
–Longer to download page.
Active Web Document
•Advantages
–Browser display can have
animation including
quickly changing data.
•Disadvantages
–Additional cost of creating
and running active
documents.
–Security risk because the
document can export as
well as import data.
–Sophisticated browser
software is required.
–Testing is difficult
because the code must run
on an arbitrary computer.
Implementation of Dynamic Documents
•The server must be capable of executing a
separate application that creates a document.
The server captures the output of the program
and sends it to the browser (HTML).
•Such a separate application program must be
written for each dynamic document (page).
•The server must know which URL’s correspond
to dynamic documents and which do not.
pf3

Partial preview of the text

Download Dynamic Web Document Technologies, (CGI, ASP, JSP, PHP, ColdFusion) | EE 432 and more Study notes Computer Systems Networking and Telecommunications in PDF only on Docsity!

Dynamic Web Document

Technologies, (CGI, ASP, JSP, PHP,

ColdFusion)

Chapter 36

Types of Web Documents

  • Static
    • Server had flat file with HTML.
    • Browser displays HTML.
  • Dynamic
    • Server runs a program to generate HTML on the fly.
    • Browser displays HTML.
  • Active
    • Server sends code to the browser imbedded in HTML.
    • Browser executes code locally to produce an interactive display.

Static Web Document

  • Advantages
    • Simplicity
    • Reliability
    • Performance
    • Browser can display a static page rapidly.
    • Local machine can cache the document to speed future requests. - Disadvantages - Inflexibility - The document must be revised by hand. - Not useful for reporting information that changes frequently.

Dynamic Web Document

  • Advantages
    • Can be used to report current information: - Stock prices - Weather conditions - Ticket availability
    • Responsibility for the information is placed on the server.
    • To the browser, it looks just like a static page. - Disadvantages - Increased cost of producing a web page because code must reside on the server. - More testing is required. - Faster server is needed. - Still cannot display animated information on the browser. - Not a good choice for displaying clock synchronized to NIST. - Longer to download page.

Active Web Document

  • Advantages
    • Browser display can have animation including quickly changing data. - Disadvantages - Additional cost of creating and running active documents. - Security risk because the document can export as well as import data. - Sophisticated browser software is required. - Testing is difficult because the code must run on an arbitrary computer.

Implementation of Dynamic Documents

  • The server must be capable of executing a separate application that creates a document. The server captures the output of the program and sends it to the browser (HTML).
  • Such a separate application program must be written for each dynamic document (page).
  • The server must know which URL’s correspond to dynamic documents and which do not.

Common Gateway Interface (CGI)

  • The CGI standard specified how a server interacts with an application program that produces a dynamic document.
  • CGI does not specify the language.
  • Program output is not restricted to HTML. Text and figures are allowed. The header specifies the type of the output. - “Content-type: text/html”
  • Redirection
    • URL: “http://someserver/cgi-bin/foo
    • Header: “Location: /new/bar.txt
    • Result: “http://someserver/new/bar.txt”

Example CGI Program

**#!/bin/sh

CGI script that prints the date

and time at which it was run.

Document header:

echo Content-type: text/plain echo

Document text:

echo This document created on echo ‘date‘**

Example “Time” Program

  • http://www-ece.eng.uab.edu/cgi- bin2/demos/time.pl
  • Produces:Welcome to UAB Department of Electrical & Computer Engineering The time is 18:

Parameters and Environment Variables

  • A server can pass arguments to the application program.
  • The values of these arguments can be supplied from the browser (appended to the URL).
  • Everything after the “?” is passed to the program as an argument.
  • The arguments are placed in environment variables.

Environment Variables

The IP address of the computer running the browser that sent the request REMOTE_ADDR Information following “?” in the URL QUERY_STRING The path in the URL after the server name SCRIPT_NAME The version of the CGI software the server is using GATEWAY_INTERFACE The domain name of the computer running the server SERVER_NAME

Display Environment Variables

  • http://www-ece.eng.uab.edu/cgi- bin2/demos/form1.pl
  • Arguments are in the form
    • ?name=value1+value
    • The + sign marks a space.
    • The? sign marks the beginning of arguments.
    • The & sign separates arguments.
  • See the example FORM on the course web site.