This section contains the difference between Servlet and. other server side technologies.
Servlet vs. other technologies
Server side programs can be written using different server-side technologies, such as Common Gateway Interface (CGI), Active Server Pages (ASP), and servlets. CGI scripts are written in C, C++, or Perl programming languages.
In case of an application server using CGI script to process client request, the server creates a separate instance of the CGI script to process the request. As a result, the efficiency of the server is affected when there is large number of concurrent requests.
ASP is a server-side technology that enables a developer to combine both HTML and scripting language in the same page. ASP objects are multithreaded and can therefore concurrently service multiple requests. The limitation of ASP is that it is not compatible with all the commercial Web servers.
Servlets are server side programs written in Java. Unlike CGI scripts, the servlet initialization code is executed only once. Moreover, separate threads in the server handle each client-request. This prevents the creation of unnecessary processes, thus enhancing the performance of the server. In addition, servlets inherit all the features of the Java programming language. For example, like all the standard Java classes, a servlet is platform-independent and can be used across different operating systems. Similarly, a servlet can make use of the extensive power of Java, such as networking, multithreading, Java Database Connectivity (JDBC), internationalization, and Remote Method Invocation (RMI).