Originally posted by Dan Jepp:
Hi,
Each time a CGI request is received the web server has to spawn a new process (v.expensive) to handle it.
With Servlet technology, the reusable servlet class is usually already loaded and in memory and ready to server the request.
Dont forget CGI is implemented via a simple script file so theres not much to reuse!
HTH
Dan
As I understand, CGI is just a protocol that specifies how the parameters from the clients can be sent to a process and vice versa. It can even be implented using
Java. I read somewhere that some webserver allow the CGI based programs in certain languages to be "always loaded". No need to spawn a whole new process. So what Vanin is saying is right. It can be and has been done.
However, the main benefit of Servlets lies in the fact that you have the whole set of Java APIs to work with. You get the standard advantages of OOP. You get platform independence. And the Java Servlet standard is very functional at a very high level, so you don't have to do much (as compared to Perl, say) to have caching etc.
BTW, you get all that using PHP too
But then it is not Java