Other Languages - what is the difference between JSP and CGI?

Asked By nadia noor on 28-Apr-09 06:23 AM

How we can differentiate the JSP and CGI with each other and on what bases bother are different?

thanx in advance

Nadia

Alice J replied to nadia noor on 28-Apr-09 06:34 AM

CGI

JSP

When a CGI program (or script) is invoked, what typically happens is that a new process is spawned to handle the request.

The first time a Servlet is requested; it is loaded into memory and cached. From then on, the same Servlet instance is used, with different requests being handled by different threads.

This process is external to that of the web server and as such, you have the overhead of creating a new process and context switching, etc.

Java Servlets on the other hand actually run inside the web server (or Servlet engine). The developer writes the Servlet classes, compiles them and places them somewhere that the server can locate them.

CGI programs or scripts on the other hand may be platform dependent, need to be recompiled or even web server dependent.

The compiled Servlet classes can be moved from one Servlet compatible web server to another very easily.

 

thanx for reply, i want some detail - Asked By nadia noor on 28-Apr-09 06:38 AM

detail relevantn to the performance , complilation , and other aspects also,

thanx in advance

Nadia

thanx for reply, i want some more detail - nadia noor replied to Alice J on 28-Apr-09 06:40 AM

end of post
JSP vs CGI - mv ark replied to nadia noor on 28-Apr-09 06:49 AM
Common Gateway Interface (CGI) is a standard protocol for interfacing external application software with a web server.
CGI is one method by which a web server can obtain data from (or send data to) databases, documents, and other programs, and present that data to viewers via the web.
A CGI program can be written in any programming language, but Perl is one of the most popular
whereas...
JavaServer Pages (JSP) is a Java-based technology from Sun Microsystems that provides a way to create web pages that display dynamically-generated content. The JSP specification defines the interaction between the server and the JSP page, and describes the format and syntax of the page.