JavaServer Pages
special tags acts as a template, or blueprint, for all the pages built by the CGI.
Unfortunately, this scheme is not quite powerful enough to do all the things dynamic
pages need to do. Or rather, by the time it does become sufficiently powerful, the set of
tags will be as complicated as any programming language, and we will be back to where
we started. Consequently, most systems built around this idea have introduced a few
mechanisms that allow this basic scheme to be extended dynamically.
The first is to allow the set of tags to be extensible. An HTML author creating a page for
a music catalog, for example, might need a tag to represent the artist's name. In an
extensible system, the HTML author could communicate this need to someone in the
programming staff, and the two could agree on a new tag to use. The HTML author could
then start using this tag while the programmer goes and writes the code that will respond
to it.
The system can also be extended in other ways. In addition to creating new tags, the
programmers could create new functions, which may be thought of as small magic black
boxes, with a slot to drop things into and a ramp where things come out. An HTML
author could, metaphorically, drop the name of a musical artist into the slot, and the
names of all that artist's albums would come spilling out from the ramp. Then tags could
be used to specify where on the page these album names should go.
Best of all, a programmer can extend a templating system like this by providing new
objects. In programming terms, objects are much like physical objects in the real world.
They have properties that can be obtained or changed, numerous complex ways in which
they may relate to other objects, and so on. In the previous example, instead of providing
a function, the programmer could provide an "artist" object. One property of this object
would be a list of albums, and an HTML-like tag could request this list. Each album
would also be an object, and some of its properties would be the year it was recorded, the
list of track names, and so on. In other words, the artist object would encapsulate all the
relevant information in one neat bundle. Again, tags could be created to access the
information from this object and the other objects it contains.
This concept is illustrated in