pdf.css
Google


   


You are here: CodeIdol > Java > JavaServer Pages > page: 16 17 18 19 20 21 22 23 24 25 26


connection to a database. Clearly, though, each Fast CGI running individually will need
its own connection. An application server can maintain a central "pool" of open
connections and hand one off to each component as needed.
Most modern application servers also support some form of load balancing. This allows
multiple instances of an application server to run, possibly on different computers. If one
application server gets too busy or one of the computers crashes, all requests can go to
another server. The users should never even notice the problem.

1.3.2 Separating HTML from Code
In parallel with the developments on the speed front, progress was made in separating
HTML from program logic. The motivation behind many of these approaches can be
understood by first considering a very simple CGI and building the complexity up from
there.
Consider again

Listing 1.1
, which is just about the simplest possible CGI. It has almost
no logic, except for the two lines needed to get the date and time. Mostly, it prints out a
bunch of HTML. Therefore, all the HTML could be pulled out of the CGI and put into a
separate file. The CGI would open this file, read the contents, and send them back to the
server. The HTML author could then edit the file without needing to touch the program
code.
Once this mechanism has been built, it is easy to extend it slowly in order to include such
things as the date and time. This is a specific instance of a general problem, namely, that
frequently a CGI will have to incorporate some data, such as the date or a user's name,
into the page.
However, the HTML author need not care where this data comes from. As far as the
design of the page is concerned, the important thing is that the date shows up where it
belongs. The HTML author could indicate this by using a special tag, perhaps something
like

<date/>
. If the CGI is written in Perl, this tag could even be a Perl variable, such as
the
$now
variable used in
Listing 1.2
. Now when it reads the HTML and before sending it
to the user, the program can look over the whole file for any occurrences of
<date/>
, do
You are here: CodeIdol > Java > JavaServer Pages > page: 16 17 18 19 20 21 22 23 24 25 26


ADBRITE ads links
   
Related tags







Popular Categories
Unix books and guides

AJAX popular information
C# language guides
Windows books and cookbooks

.......








Business Key Top Sites

be number one
rate your site




    С 2009 года мы стали переводить структура сайта на различные языки. Сайт теперь будет содержать книги не только на английском языке, но также и на других европейских языках, в том числе и на Русском языке.

    Русский Polski Francais Deutsch
    support sitemap terms

© CodeIdol Labs, 2007 - 2009