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

Why doesn’t a servlet include main()?

785


How can you run a servlet program?

801


What are the important functions of filters?

818


How can we upload the file to the server using servlet?

759


How to get the path of servlet in the server?

732


When jsessionid is created?

779


What is the process to implement doget and dopost methods?

737


What is the difference between get and post methods?

786


Explain jsessionid?

805


What is the purpose of requestdispatcher interface?

827


Differentiate between get and post?

895


Difference between httpservlet and generic servlets?

841


Why servlet is faster than jsp?

772


What is context in servlet?

766


hi actully i hav form columns with origin and destination names .as like as i need to create one more column with name amount. my requirement is when i select origin and destination columns automatically i need to get amount from database.how can i. please tel me with relative code

2519