what is the advantage of using Servlets over CGI programming?

Answers were Sorted based on User's Feedback



what is the advantage of using Servlets over CGI programming?..

Answer / mdsha_asiya

The problem with CGI script is that your server must
restart the CGI script every time a new request is
issued.This means every time a client communicates,your
server needs to begin a new proccess .starting and stopping
processes are expensive operions.
The difference between servlet and CGI scritpt is that CGI
script must be restarted every request where as servlets
are pooled and reused over and over again to service many
requests.This means you don't have to restart a process
every time client request comes over the network.

After servlet is loaded,to handle client request it simply
creates a thread and runs service() of servlet.


servlets are more efficient,powerful,portable,inexpensive
and convinent.

Is This Answer Correct ?    14 Yes 2 No

what is the advantage of using Servlets over CGI programming?..

Answer / janet

Servlets are only instantiated when the client first
accesses the program. All subsequent accesses are done to
that instance.This keeps the response time of servlets lower
than that of CGI programs, which must be run once per
hit.also because servlet is instantiated only once,all
accesses are put through that one object. This helps in
maintaining objects like internal connection,pooling or user
session tracking and lots of other features.

Is This Answer Correct ?    11 Yes 0 No

what is the advantage of using Servlets over CGI programming?..

Answer / 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

what is the advantage of using Servlets over CGI programming?..

Answer / ravat

There is only one main difference between CGI and Servlet that CGI is not that much efficient as servlets ,because Wen each time request cames to CGI it ll start from first i.e loading,instantiation and ll consume more time but in the case of Servlet only once server is loaded and instance is created and it is reused to other request and wenever the new request cames just it ll make use of same object

Is This Answer Correct ?    3 Yes 3 No

Post New Answer

More Servlets Interview Questions

What is webservlet?

0 Answers  


What compiler do not do if we create our own constructor?

5 Answers   HCL,


What's the advantages using servlets than using cgi?

0 Answers  


What are the jobs performed by servlets?

0 Answers  


can v create a constructor 4 servlet?

7 Answers   Satyam,






What is load-on-startup in servlet?

0 Answers  


What are different ways for servlet authentication?

0 Answers  


Define the lifecycle for executing a jsp page.

0 Answers  


Why is httpservlet declared abstract?

0 Answers  


What are the type of protocols used in httpservlet?

0 Answers  


How is the get () method different from the post() method?

0 Answers  


Hi frnd can i any one kindly can post for me portlet,hibernate and spring example application and with flow explantion configuration using Jdeveloper.and related links ar tutorials kindly please send me .its urgent for me .thanks in advance...........else can any one send to kondaiah.goddeti@gmail.com

0 Answers  


Categories