describe the advantages of java servlets over cgi


Describe the advantages of JAVA servlets over CGI interface.

The Advantage of Servlets Over "Tradi tional" CGI:

Java servlets are extra efficient, easier to utilize more powerful, additionally portable and cheaper than traditional CGI and several alternative CGI as technologies. More significantly, servlet developers find paid more than Perl programmers.

  • Efficient. With traditional CGI, a new process is started for each HTTP request. If the CGI program does a relatively fast operation, the overhead of starting the process can dominate the execution time.

With servlets, the Java Virtual Machine stays up, and each request is handled by a lightweight Java thread, not a heavyweight operating system process.

  • Convenient. Hey, you already know Java. Why learn Perl too? Besides the convenience of being able to use a familiar language, 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 utilities.
  • Powerful. Java servlets let you easily do several things that are difficult or impossible with regular CGI. For one thing, servlets can talk directly to the Web server (regular CGI programs can't). This simplifies operat ions that need to look up images and other data stored in standard places. Servlets can also share data among each other, making helpful things like database connect ion pools easy to implement. They can also keep information from request to request, simplifying things as session tracking and caching of previous computations.
  • Portable. Servlets are written in Java and follow a well-uniform API. Therefore, servlets written for, say I-Planet Enterprise Server can run virtually unchanged on Apache, Microsoft IIS, or WebStar. Servlets are supported directly or through a plug into on almost every important Web server.
  • Inexpensive. There are a number of free or very inexpensive Web servers available that are good for "personal" utilize or low-volume Web sites. However, with the main except ion of Apache that is free, most commercial-quality Web servers are relatively expensive.

However, once you have a Web server, no issue the cost of that server, adding servlet support to this (if this doesn't come preconfigured to hold servlets) is usually free or cheap.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: describe the advantages of java servlets over cgi
Reference No:- TGS0283259

Expected delivery within 24 Hours