Home Servlets Advantages of Servlets over CGI
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

Advantages of Servlets over CGI

Advertisement
Servlets are server side components that provides a powerful mechanism for developing server web applications for server side.

Advantages of Servlets over CGI

     

Servlets are server side components that provides a powerful mechanism for developing server web applications for server side. Earlier CGI was developed to provide server side capabilities to the web applications. Although CGI played a major role in the explosion of the Internet, its performance, scalability and reusability issues make it less than optimal solutions. Java Servlets changes all that. Built from ground up using Sun's write once run anywhere technology java servlets provide excellent framework for server side processing.

Using servlets web developers can create fast and efficient server side applications and can run it on any servlet enabled web server. Servlet runs entirely inside the Java Virtual Machine. Since the servlet runs on server side so it does not depend on browser compatibility.

Servlets have a number of advantages over CGI and other API's. They are:

  1. Platform Independence
    Servlets are written entirely in java so these are platform independent. Servlets can run on any Servlet enabled web server. For example if you develop an web application in windows machine running Java web server, you can easily run the same on apache web server (if Apache Serve is installed) without modification or compilation of code. Platform independency of servlets provide a great advantages over alternatives of servlets.
  2. Performance
    Due to interpreted nature of java, programs written in java are slow. But the java servlets runs very fast. These are due to the way servlets run on web server. For any program initialization takes significant amount of time. But in case of servlets initialization takes place first time it receives a request and remains in memory till times out or server shut downs. After servlet is loaded, to handle a new request it simply creates a new thread and runs service method of servlet. In comparison to traditional CGI scripts which creates a new process to serve the request. 
  3. Extensibility
    Java Servlets are developed in java which is robust, well-designed and object oriented language which can be extended or polymorphed into new objects. So the java servlets take all these advantages and can be extended from existing class to provide the ideal solutions.
  4. Safety
    Java provides very good safety features like memory management, exception handling etc. Servlets inherits all these features and emerged as a very powerful web server extension.
  5. Secure
    Servlets are server side components, so it inherits the security provided by the web server. Servlets are also benefited with Java Security Manager.
Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 18, 2008

Related Tutorials

Ask Questions?    Discuss: Advantages of Servlets over CGI   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
RAJESH SINGH
June 13, 2013
COMPUTER

java I want to make the good java developer.
malekar
August 31, 2011
servlets

what is servlets
PRASAD
June 3, 2012
JAVA

roseindia is very nice site .i learnt so much from this site.
Kavitha
June 24, 2012
need guidance

I am very satisfied with the theory.I need some solved programs with real time examples in servlet.
mounika
July 14, 2014
servlet

servlet is a sub class to httpservlet r not?
DMCA.com