Java Servlets   «Prev  Next»

Lesson 5The problems with CGI
Objective What are the problems with CGI?

What are the Traditional Problems with CGI ?

A CGI program can be written in any language .
Prerequisites: Be able to produce a program that will execute on your server machine. In practice, most Web developers use a compiled language like C or a scripting language like Perl. Perl is the popular choice for CGI programming because it is powerful and widely available.
  1. Perl programs are challenging for humans.
  2. There is also a performance issue with CGI programming.
  3. If you have a popular site, different users could be using the same CGI program simultaneously.
  4. The Web server will start a new copy of the program for each of them.
And if the program is in Perl, it will start a whole new copy of the Perl interpreter for each of them. This can waste a great deal of execution time and limit the number of users your server can handle.
Servlets are more efficient than this.

1) CGI Connect 1 2) CGI Connect 2 3) CGI Connect 3 4) CGI Connect 4 5) CGI Connect 5 6) CGI Connect 6 7) CGI Connect 7 8) CGI Connect 8 9) CGI Connect 9 10) CGI Connect 10 11) CGI Connect 11 12) CGI Connect 12

Servlets are Convenient

Servlets have an extensive infrastructure for automatically parsing and decoding HTML form data, reading and setting HTTP headers, handling cookies, tracking sessions, and many other such high-level utilities. In CGI, you have to do much of this yourself. Besides, if you already know the Java programming language, why learn Perl too?
You are already convinced that Java technology makes for more reliable and reusable code than does Visual Basic, VBScript, or C++.
Why go back to those primitive languages for server-side programming?
Server side includes (SSI) will be discussed in the next lesson.