what is the advantage of using Servlets over CGI programming?

Answer Posted / sandeep m

CGI programs need separate process to process a request.
For which CGI object has to be created and destroyed for
each request or else pool of processes can be maintained by
server and for each request a process is assigned by server
which will be returned back to server after request
processing.
Servlets use Threads. Due to which single Servlet object is
created. Whenever a request is received by server a new
thread is created and the thread uses the existing Servlet
instance.
Advantage is process creation is heavy weight. Threads are
light weight. Burden of creating and destroying processes
is reduced or else maintaining process objects in pool is
reduced. Any number of requests can be served with not much
burden on server

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the war file?

612


What is generic servlet class?

605


Which http method is said to be non-idempotent and idempotent?

608


Given the request path below, which are context path, servlet path and path info?

549


Which httpsession object is used to view and manipulate information about a session?

736






What’s the use of the servlet wrapper classes??

644


Why is http protocol called as a stateless protocol?

537


How can we include static files in the jsp page?

615


What do you mean by url pattern in servlet?

631


What is the use of servletconfig interface?

560


What is servlet instance?

544


What is the difference between the http servlet and generic servlet?

604


What is the difference between 2 types of servlets?

650


How do you invoke a servelt?

630


Explain the steps involved in placing a servlet within a package?

573