Servlets - SPLessons

Servlet Advantages

Chapter 45

SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

Servlet Advantages

Servlet Advantages

shape Description

Servlet Advantages, The Servlet is a Java program which can run in Web server or Application server and act as a mediator from a web browser or client to the database or Server. For this Servlet, one can take input from the users through HTML or Web forms and can also take present records from databases and create web forms dynamically.Now, there comes a doubt about what is a Web server and Application server.

Web server only supports Web application like Servlets, JSP , HTML  and Application Server support Enterprise Edition like Servlets, JSP , HTML, EJB (Enterprise Java Bean) , JMS (Java Message Service) and the Application Server is Superior (Web Server + EJB + JMS). Following is a conceptual figure which gives more regarding web server and application server. Following are the advantages of servlet.

shape Advantages


Advantages of Servlet over CGI

shape Advantages

  • The main advantage of servlet over CGI is platform independent. Servlet runs on any operating system along with JVM installation which means that would not be having any problem even if switched to other operating system, with CGI. Switching to another operating system is more difficult. One needs to recompile the program in the new operating system.
  • Servlet runs on thread based application while CGI runs on separate Processor based application. If the number of clients increases, CGI takes more time for sending a response.But servlets takes less time for sending a response.
  • In the above diagram, a lot of disadvantages occurs in CGI which is a specification to develop Server-side Web resource program. So PERL (practical extraction reporting language) programming language will be used to develop the web resource program based on CGI.
  • CGI takes each Request as one processor. So it takes the burden of the processor for processing the Request.
  • CGI is a platform dependent language like C, C++, PERL.
  • From the above diagram, only one processor has taken so many threads. In that, thread only processes Request. So there will be less burden on the processor.

Summary

shape Key Points

  • CGI stands for common gate way interface.
  • Servlet is similar to applets, but applets are persistent.
  • Servlet creates a thread in which thread takes only HTTP Request and Response is processed.
  • Servlets packages will be used in Java frameworks also while developing web applications.