What are the advantages of servlets over CGI?

0 votes
asked Jun 17, 2016 in Java by Surya
, , 111 views Last updated : Feb 25, 2018

3 Answers

0 votes

Servlets offer several advantages in comparison with the CGI.

  • Performance is significantly better.
  • Servlets execute within the address space of a Web server. It is not necessary to create a separate process to handle each client request.
  • Servlets are platform-independent because they are written in Java.
  • Java security manager on the server enforces a set of restrictions to protect the resources on a server machine. So servlets are trusted.
  • The full functionality of the Java class libraries is available to a servlet. It can communicate with applets, databases, or other software via the sockets and RMI mechanisms that you have seen already.
answered Jun 20, 2016 by Nani
0 votes

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.

answered Feb 19, 2017 by muneshs16
0 votes

CGI (common gateway interface) creates new thread for each user request on the other hand Servlet use the concept of a process. A process may contains one or many threads . Servlet is lightweight and fast.

answered Jul 13, 2017 by LogenRahul

Related questions

What are the major tasks of servlets?

Java Servlets are programs that run on a Web or Application server and act as a middle layer between a request coming from a Web browser or other HTTP client and databases or applications on the HTTP...

java, jdbc, servlet 2 Answer 221 views asked Jun 17, 2016 in Java by Narayana

What are servlets filters?

Servlet Filters are Java classes that can be used in Servlet Programming for the following purposes:To intercept requests from a client before they access a resource at back end.To manipulate...

java, android, jdbc, servlet 2 Answer 93 views asked Jun 30, 2016 in Java by RajaSekhar

What are Servlets?

Servlets provide a component-based, platform-independent method for building Web-based applications, without the performance limitations of CGI programs. Servlets have access to the entire family of...

java, jdbc, servlet 2 Answer 71 views asked Jun 17, 2016 in Java by Estela