Techniques used for Generating Dynamic Content Using Java Servlets.

Techniques used for Generating Dynamic Content Using Java Servlets. Techniques used for Generating Dynamic Content Common Gateway Interface (CGI) For any web application high performance and timely delivery are key ingredients to competitive

Techniques used for Generating Dynamic Content Using Java Servlets.

Techniques used for Generating Dynamic Content

Common Gateway Interface (CGI)

For any web application high performance and timely delivery are key ingredients to competitive success.

Earlier CGI was developed to provide the server-side capability to web application. Although CGI played a major role in the explosion of Internet, it's performance, scalability and usability issues make it less than the optimal solution. CGI runs in a separate process separated from the web server and it requires more hardware and software resources. CGI programs are slow because for each a new call is to the CGI program, which subsequently runs in a separate process. If your program needs to interact with Web Server, using CGI program you can't accomplish it as CGI's separate process can't interact with Web Server.

Scripting Languages

To solve all these problems several companies have developed server-side scripting languages. These scripts are popular and allows developers to develop web applications that generates dynamic pages. Microsoft has developed  ASP (Active Server Pages) for IIS Server and Cold Fusion is product of Allaire. Web Server interprets these scripts when the pages are served. These scripting languages provide good performance but imposes the portability issues as they are limited to particular group of products or operating system.

Server plug-in technologies

Server side plug-in technology provide very good performance. NSAPI is the plug-in from Netscape and ISAPI is from Microsoft. Programming using these plug-in are difficult and also learning curve is also very high.

Java Servlets

Java Servlets eliminated all these problems. The first truly platform independent web development technique, Java Servlets breaks down all traditional barriers giving you flexibility to run your Web Application on any Web Server. Built from the ground up using Sun's write once run anywhere technology, Java Servlets provide excellent framework to develop server-side application without sacrificing functionality or performance.

With Java Servlets you can finally develop your web application that can run on any platform. Java Servlets have number of advantages over CGI and other API's. They are:

  1. Platform Independence:
    This is very important feature of Servlets, which makes them portable across platforms and across different Web Servers, because the Servlet API defines a standard interface between a Servlet and a Web Server.
      
  2. Persistent:
    Java Servlets are loaded once by a Web Server when it receives a request from the client and serving the subsequent request is just a matter of creating new thread. Servlets can maintain system resources (e.g.. database connectivity etc.) between requests, thus making it easy to share resources like database connectivity.
      
  3. Familiarity:
    Servlets are written in Java Language, so anyone having some programming knowledge in Java can learn Servlets easily. This saves saves the valuable time of learning a new programming language.
      

In the next section we learn about JDBC and see how to use JDBC to connect our search engine to database.