The Internet Encyclopedia (Volume 3)

(coco) #1

P1: 61


Irie WL040/Bidgoli-Vol III-Ch-62 June 23, 2003 16:43 Char Count= 0


DYNAMICSITES 769

generates new data. It drives the interaction between the
Web site and the user and is the glue that binds the content
and its presentation. To be useful, it needs to access the
content as well as its presentation information and han-
dle user input accordingly. Logic is usually implemented
as small programs, or scripts, that are executed on the
Web server or the user’s browser. These scripts can be
stored within the HTML page, along with the presentation
and content, or separately as distinct program files that
are associated with the content. There are several stan-
dard programming languages that can be used in writing
scripts.

Separation of Components
With the existence of a variety of technologies, protocols,
and standards, Web development is remarkably flexible,
and there are often multiple ways of accomplishing the
same task. This is both an asset and a liability, as while
developers are free to choose their own techniques, it is
very easy to create sloppy or undisciplined documents and
code. In regular application development, it is important
to adhere to sound software engineering techniques to
manage a code base for future enhancements and simul-
taneous development efforts. The flexibility of Web deve-
lopment makes such good techniques even more critical.
Until very recently, there was a great deal of overlap,
in terms of storage and implementation, of the three Web
site components mentioned above. This led, for example,
to Web pages that contained all three components in a
single, often unmanageable, HTML file. As Web site de-
velopment has matured, the principle of Web site com-
ponent separation has become widely encouraged, if not
accepted, and it is the central theme of this chapter.

IMPLEMENTATION ISSUES
The World Wide Web (WWW) is a series of client/server
interactions, where the client is the user’s Web browser,
and the server is a particular Web site. The WWW Con-
sortium (W3C) defines the hypertext markup language
(HTML) and the hypertext transfer protocol (HTTP) as
the standard mechanisms by which content is published
and delivered on the Web, respectively.
In essence, the local Web browser initiates HTTP re-
quests to the remote Web server, based on user input.
The Web server retrieves the particular content specified
by the requests and transmits it back to the browser as
an HTTP response. The Web browser then interprets the
response and renders the received HTML content into a
user-viewable Web page.
Web site implementations can be classified by the level
of interactivity and the way content is stored, retrieved,
and displayed.

Static Sites
Static sites are the simplest type of Web sites, with the
content statically stored in HTML files, which are simple
text files. Updating the Web site requires manually chang-
ing individual HTML text files. While this type of site was
prevalent in the beginning, most sites, especially commer-
cial ones, have come to incorporate at least some degree

Figure 1: Block diagram of a client/server archi-
tecture with a static Web site.

of dynamic behavior, and users have come to expect some
interactivity.
Figure 1 shows the basic client–server interaction for a
static Web site. The client browser makes an HTTP request
to a Web server. The URL specifies the particular Web
server and page. The Web server retrieves the requested
Web page, which is an HTML file, from the file system and
sends it back to the client through the HTTP response.
This very basic interaction between browser and server
is the basis for more complex, dynamic interactions. This
type is static because the Web page content is straight
HTML, statically stored on disk, with no mechanism to
change the contents. The Web server here serves solely as
a file transfer program.
Developing static sites requires very few tools. All that
is required, besides the Web server and browser, is a text
editor application. The simplest text editor can be used to
manually create HTML files. Complex, graphical HTML
editors can make the task almost trivial by automatically
generating HTML files and behaving similarly to word
processors, with WYSIWYG (what you see is what you
get) interfaces. Creating graphics and images for static
Web sites is also straightforward, requiring any typical
paint or drawing program.

DYNAMIC SITES
Dynamic sites share the same basic architecture as static
ones, but with the addition of programming logic. The two
major types of dynamic sites reflect the place of execution
of the scripts. Client-side scripting involves embedding ac-
tual source code in HTML, which is executed by the client
browser in the context of the user’s computer. Server-side
scripts, on the other hand, are executed on the Web server.
While the following discussion examines both types sep-
arately, in an actual Web site both types can and often do
exist simultaneously.

Client Side
Figure 2 shows the basic architecture for a dynamic site
with client-side scripting. Scripts are embedded within
HTML documents with the <script> </script> tags or
stored in separate documents on the server’s file system.
Scripts are transmitted, without execution, to the client
browser along with the rest of the HTML page. When
the client browser renders the HTML page, it also in-
terprets and executes the client script. An example of a
client-side script is the functionality that causes a user
interface element, such as a menu, to provide visual feed-
back when the user moves the mouse pointer over a menu
option.
Free download pdf