Java Servlets

Java Servlets

A Java servlet is a server-side program that is called by the user interface or another J2EE component and contains the business logic to process a request. Java servlets call other components that handle processing logic. Originally a server-side program handles client request by using Common Gateway Interface (CGI), which was programmed using Perl or any other high-level programming language. Java Servlets initial efforts were to replace CGI programming. Although Java Servlet Technology replaces CGI, Java servlet technology, and CGI both provide the same basic functionality. That is explicit and implicit data is sent from the client to a server-side program in the form of a request that is processed and another set of explicit date is returned. Explicit data is information received from the client that this typically either entered by the user or into the user interface or generated by the user interface itself. For example, user ID and password are explicit data that is generated by the browser or a custom client.

 

 

Java servlets are designed to be more efficient and use less environment overhead then CGI. In CGI Model a new process begins each time a request is made to a CGI program. Also, a CGI program is not persistent. Java servlets technology avoids inefficiencies. First, only one copy of Java servlet is loaded into Java virtual machine, no matter the number of simultaneous requests made. Each request begins a thread to the Java servlet rather than a new process, which saves memory usage on the server and increases a response time because only one copy of the Java servlet needs to be loaded into the memory. Java servlet has persistent, it remains alive after the request is fulfilled and data used by the Java servlet can be retained between calls to Java servlets. Watch the video below for more details explanation of Java Servlets Concepts.

 

Video: Java Servlets Programming
 

The above video tutorial consists of Servlets introduction, What is CGI, differences between Servlets and CGI programming, benefits of using Java Servlets, Anatomy or Life-Cycle of Servlets, how to write Java Servlet program, and practical implementation of Java Servlets, and Sessions Tracking using Java Servlets.