SERVER-SIDE
PROCESSING.
Generally dynamic or data-driven Web pages use HTML
forms to collect user inputs, submitting them to a Web server. A program
running on the server processes the form inputs, dynamically composing a Web
page reply. This program, which is called, servicing program, can be either a
compiled executable program or a script interpreted into machine language each
time it is run.
Compiled server programs. When a user submits HTML- form data for processing by a compiled server
program, the Web Server invokes the servicing program. The servicing program is
not part of the Web server but it is an independent executable program running
on the Web server; it processes the user input, determines the action which
must be taken, interacts with any external sources (Eg: database) and finally
produces an HTML document and terminates. The Web server then sends the HTML
document back to the user’s browser where it is displayed. Figure 5.3 shows the
flow of HTTP request from the client to the Web server, which is sent to the
servicing program. The program creates an HTML document to be sent to the
client browser.
Popular languages for creating compiled server programs are Java, Visual
Basic, and C++, but almost any language that can create executable programs can
be used, provided that it supports commands used by one of the protocols that
establish guidelines for communication between Web servers and servicing programs.
The first such protocol, introduced in 1993, for use with HTML forms was the
Common Gateway Interface (CGI); many servicing programs on Web sites still use
CGI programs. However, a disadvantage of using CGI-based servicing programs is
that each form submitted to a Web server starts its own copy of the servicing
program on the Web server.
A busy Web server is
likely to run out of memory when it services many forms simultaneously; thus,
as interactive Web sites have gained popularity, Web server vendors have
developed new technologies to process form inputs without starting a new copy
of the servicing program for each browser input. Examples of these technologies
for communicating with Web servers include Java Servlets and Microsoft’s
ASP.NET; they allow a single copy of the servicing program to service multiple
users without starting multiple instances of the program.
Server-Side Scripts. Web-based applications
can also use server-side scripts to create dynamic Web pages that are able to
retrieve and display information from a backend database and modify data
records. The processing architecture is the same as the processing architecture
used for compiled server programs except the Web server processing is performed
through and interpreted script rather than a compiled program.
If needed, a developer can have a single Web server
process a variety of scripts written with any or all of these technologies. The
Web server knows which script interpreter to invoke by taking note of the
requesting script’s file extension. Table below demonstrates some commonly used
extensions and the related technologies.
Processing Technology for different File Extensions
File
Extension
|
Processing
technology interpreter/compiler
|
.PHP
|
PHP Script
|
.asp
|
Microsoft Active Server Page
|
.aspx
|
Microsoft
ASP.NET web page
|
.js
|
Microsoft
Scripting Language “JScript” file extension
|
.vbp
|
Visual Basic
Project
|
Fig 5.1
Server-side hybrid processing. Compiled server-side
programs offer two main advantages: First, they are compiled and stored in a
machine-readable format; so they usually run faster than scripts. Second, compiled
programs are usually created in integrated development environments that
provide debugging utilities. The advantage of using scripts is that their
modification requires only a text editor rather than installation of an
associated development environment.
Hybrid server-side
programming strives to combine the advantages of compiled server-side programs
and server-side scripts; a server-side script is created but not compiled. The
first time a user accesses a Web page calling the script, the script is
compiled into machine-readable format and stored as an executable file. With
this approach, the developer works with ordinary text files and does not need
to install an integrated programming development environment to modify the
script. Performance is improved because the program does not need to be
translated into machine language each time it runs.
No comments:
Post a Comment