KEMBAR78
Java servlets and CGI | PPTX
JAVA SERVLETS AND CGI
Presented by
M.LAVANYA
M.sc(CS & IT)
Nadar Saraswathi college of arts & science,
Theni.
INTRODUCTION TO SERVLETS
• Servlet Technology is used to create web applications.
• Servlet technology uses Java language to create web
applications.
• Web applications are helper applications that resides at web
server and build dynamic web pages.
• A dynamic page could be anything like a page that randomly
chooses picture to display or even a page that displays the
current time.
As Servlet Technology uses Java, web applications made using
Servlet are Secured, Scalable and Robust.
INTRODUCTION OF CGI
• CGI (Common Gateway Interface) is used to provide dynamic
content to the user.
• CGI is used to execute a program that resides in the server to
process data or access databases to produce the relevant
dynamic content.
• Programs that resides in server can be written in native
operating system such as C++.
DIAGRAMMATIC REPRESENTATION
DIFFERENT OF CGI
Servlet CGI (Common Gateway Interface)
Servlets are portable CGI is not portable.
In Servlets each request is handled by
lightweight Java Thread
IN CGI each request is handled by heavy
weight OS process
In Servlets, Data sharing is possible In CGI, data sharing is not available.
Servlets can link directly to the Web
server
CGI cannot directly link to Web server.
Session tracking and caching of previous
computations can be performed
Session tracking and caching of previous
computations cannot be performed
Automatic parsing and decoding of
HTML form data can be performed.
Automatic parsing and decoding of
HTML form data cannot be performed.
Servlets can read and Set HTTP Headers CGI cannot read and Set HTTP Headers
Servlets can handle cookies CGI cannot handle cookies
Servlets can track sessions CGI cannot track sessions
Servlets is inexpensive than CGI CGI is more expensive than Servlets
CGI (COMMON GATEWAY INTERFACE)
• Before Servlets, CGI(Common Gateway Interface)
programming was used to create web applications. Here's how
a CGI program works :
• User clicks a link that has URL to a dynamic page instead of a
static page.
• The URL decides which CGI program to execute.
• Web Servers run the CGI program in separate OS shell. The
shell includes OS environment and the process to execute code
of the CGI program.
• The CGI response is sent back to the Web Server, which wraps
the response in an HTTP response and send it back to the web
browser.
CGI
DRAWBACKS OF CGI PROGRAMS
• High response time because CGI programs execute in their
own OS shell.
• CGI is not scalable.
• CGI programs are not always secure or object-oriented.
• It is Platform dependent.
SERVLETS
• CGI programs are used to execute programs written inside the
native language. But in Servlet all the programs are compiled
into the Java byte code which is then run in the Java virtual
machine.
• In Servlet, All the requests coming from the Client are
processed with the threads instead of the OS process.
SERVLETS ENGINE
Java servlets and CGI

Java servlets and CGI

  • 1.
    JAVA SERVLETS ANDCGI Presented by M.LAVANYA M.sc(CS & IT) Nadar Saraswathi college of arts & science, Theni.
  • 2.
    INTRODUCTION TO SERVLETS •Servlet Technology is used to create web applications. • Servlet technology uses Java language to create web applications. • Web applications are helper applications that resides at web server and build dynamic web pages. • A dynamic page could be anything like a page that randomly chooses picture to display or even a page that displays the current time.
  • 3.
    As Servlet Technologyuses Java, web applications made using Servlet are Secured, Scalable and Robust.
  • 4.
    INTRODUCTION OF CGI •CGI (Common Gateway Interface) is used to provide dynamic content to the user. • CGI is used to execute a program that resides in the server to process data or access databases to produce the relevant dynamic content. • Programs that resides in server can be written in native operating system such as C++.
  • 5.
  • 6.
    DIFFERENT OF CGI ServletCGI (Common Gateway Interface) Servlets are portable CGI is not portable. In Servlets each request is handled by lightweight Java Thread IN CGI each request is handled by heavy weight OS process In Servlets, Data sharing is possible In CGI, data sharing is not available. Servlets can link directly to the Web server CGI cannot directly link to Web server. Session tracking and caching of previous computations can be performed Session tracking and caching of previous computations cannot be performed
  • 7.
    Automatic parsing anddecoding of HTML form data can be performed. Automatic parsing and decoding of HTML form data cannot be performed. Servlets can read and Set HTTP Headers CGI cannot read and Set HTTP Headers Servlets can handle cookies CGI cannot handle cookies Servlets can track sessions CGI cannot track sessions Servlets is inexpensive than CGI CGI is more expensive than Servlets
  • 8.
    CGI (COMMON GATEWAYINTERFACE) • Before Servlets, CGI(Common Gateway Interface) programming was used to create web applications. Here's how a CGI program works : • User clicks a link that has URL to a dynamic page instead of a static page.
  • 9.
    • The URLdecides which CGI program to execute. • Web Servers run the CGI program in separate OS shell. The shell includes OS environment and the process to execute code of the CGI program. • The CGI response is sent back to the Web Server, which wraps the response in an HTTP response and send it back to the web browser.
  • 10.
  • 11.
    DRAWBACKS OF CGIPROGRAMS • High response time because CGI programs execute in their own OS shell. • CGI is not scalable. • CGI programs are not always secure or object-oriented. • It is Platform dependent.
  • 12.
    SERVLETS • CGI programsare used to execute programs written inside the native language. But in Servlet all the programs are compiled into the Java byte code which is then run in the Java virtual machine. • In Servlet, All the requests coming from the Client are processed with the threads instead of the OS process.
  • 13.