Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What advantages do servlets have over CGI programs?

Answer Posted / gunasekar

1. Efficient
With traditional CGI, a new process is started for each HTTP request. If the CGI program itself is relatively short, the overhead of starting the process can dominate the execution time. With servlets, the Java virtual machine stays running and handles each request with a lightweight Java thread, not a heavyweight operating system process.

2. 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?

3. Powerful
Servlets support several capabilities that are difficult or impossible to accomplish with regular CGI. Servlets can talk directly to the Web server, whereas regular CGI programs cannot, at least not without using a server-specific API.

4. Portable
Servlets are written in the Java programming language and follow a standard API and thus are portable themselves.

5. Inexpensive
A number of free or very inexpensive Web servers are good for development use or deployment of low- or medium-volume Web sites.This is in contrast to many of the other CGI alternatives,
which require a significant initial investment for the purchase of a proprietary package.

6. Secure
One of the main sources of vulnerabilities in traditional CGI stems from the fact that the programs are often executed by general-purpose operating system shells. So, the CGI programmer must be careful to filter out characters such as backquotes and semicolons that are treated specially by the shell. Implementing this precaution is
harder than one might think, and weaknesses stemming from this problem are constantly being uncovered in widely used CGI libraries.
A second source of problems is the fact that some CGI programs are processed by languages that do not automatically check array or string bounds. Servlets suffer from neither of these problems. Even if a servlet executes a system call (e.g., with Runtime.exec or JNI) to invoke a program on the local operating system, it does not use a shell to do so. And, of course, array bounds checking and other memory protection features are a central part of the Java programming
language.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you invoke a servelt?

1071


Which event is fired at the time of project deployment and undeployment?

1274


What do you mean by httpservlet and how it is different from the genericservlet?

1003


What do you mean by request dispatcher in servlet? Also explain its methods.

1098


What do you mean by session tracking and also explain its techniques?

913


How many servlet objects are created?

1020


What are the difference between session and cookies in servlet? Explain

1009


What is the use of welcome-file-list?

986


What is difference between GenericServlet and HttpServlet?

1081


What do you mean by httpservlet?

1011


How do cookies work in servlets?

1005


What is the difference between Server and Container?

1191


What does the term localization refer to?

1044


How to get the current httpsession object?

1080


What are the disadvantages of storing session state in cookies?

1104