Programming Specialized Behavior for Web Pages
The following topics are for the advanced student who would
like to customize a web page to perform specific functions that
he or she cannot get using HTML. These functions could be
to create interfaces to databases, create client-side dynamic
processes, or even Java applets.
We cover three forms of programming advanced behavior
for web pages:
Common-Gateway Interfaces
The Common Gateway Interface (CGI) is a standard for external
gateway programs to interface with information servers, such as
HTTP or Web servers. A plain HTML document that a web page server
retrieves is static, which means it is a text file that doesn't change.
A CGI program, on the other hand, executes as a program when the
link to it is clicked. At that moment, the program executes some
specified instruction, such as starting up some other application
or input data into a database,
process some data the user sent with a forms page, and perhaps return
a new "dynamic" web page is created with data looked up in some data base.
A CGI program is generally invoked through the use of web page forms.
When you fill out a form and then submit it, a message is sent to
the web page server to execute a cgi program that it has stored
in its CGI_bin. This message has the name of the desired CGI program
to execute and a list of parameters (data) that the CGI program will use in its
execution. Once it executes, the CGI program may create
an output page that the web server then returns to the user's browser.
The quizes you are taking for this class is an example of CGI programming.
The quizes you see are forms that send your responses to a CGI program which
grades your submission by looking up the appropriate answers from a database.
It then compares your answer to the expected answers, scores your
quiz, and then records it into the database for your grade. The quizit logon
is also a CGI connected to the logon form.
Because a CGI program is executable, it is basically the equivalent of
letting the world run a program on your system, which isn't
the safest thing to do. Therefore, there are some security precautions
that need to be implemented when it comes to using CGI
programs. Probably the one that will affect the typical Web user
the most is the fact that CGI programs need to reside in a
special directory, called the CGI_bin so that the Web server
knows to execute the program rather than just display it to the
browser. This directory
is usually under direct control of the webmaster, prohibiting the
average user from creating CGI programs. There are other
ways to allow access to CGI scripts, but it is up to your webmaster
to set these up for you.
A CGI program can be written in any language, although the most common
are PERL and C. Which language it is developed in is a matter of
whatever the server machine supports, and whatever is preferred by the
CGI programmer.
More about CGI programming can be found at these sights:
Javascript
JavaScript is an object-based scripting language for developing client and server
Internet applications. Most Internet browsers interpret JavaScript statements
embedded directly in an HTML page. JavaScript statements
can recognize and respond to user events such as mouse clicks, form input, and page
navigation. It executes client-side instructions to enhance the user interface
of a page, produce animations, bring up separate browser windows, preprocess
form responses, or produce
more complex, programmable behavior in your browser. For example, you can write a
JavaScript function to verify that users enter valid
information into a form requesting a telephone number or zip code.
JavaScript looks similar to Java source code, however, they are not the same thing.
JavaScript is much more limited and only runs within the confines of your browser.
More about JavaScript programming can be found at this sight:
Sun Microsystem's Java
Java is an object-oriented programming language developed
by Sun MicroSystems for use in a distributed (Internet)
environment and for easy transportability across
multiple platforms (computers and operating systems).
The most common Java programs are applications and applets.
Applications are standalone programs. What is more relevant to
this discussion are applets. Applets are similar to applications
that adhere to a set
of conventions. These conventions let them run within a Java-compatible browsers,
such as Netscape Navigator or Internet Explorer.
If you're using a browser that can view applets,
you should see an animation just below this paragraph --
that's an applet embedded in this HTML page.
More information about Java can be found at: