by Dinesh Thakur Category: introduction to Servlet

Internet and WWW are often used interchangeably but both are different. Internet is the global network of computer networks whereas Web is one of the services provided over Internet. That is, Web is an application running over Internet. While creating web applications, the main goal is to perform most of the processing on the browser side, there by, reducing processing load on the server side.

 

However, sometimes it is not possible to eliminate all processing at the server side. For example, in situations like online registration, retrieving data from underlying data, etc., some processing might be required at the server side. One of the server side technologies, servlets is used to handle server side processing. Servlets are small programs written in Java, which are loaded and executed by web server as applets are loaded and executed by web browser. Since, servlets are written in Java, they are platform independent and also posses all other advantages of Java.

Advantages of servlets

A servlet can be imagined to be as an applet running on the server side. Some of the other server side technologies available are Common Gateway Interface (CGI), server side JavaScript and Active Server Pages (ASP). Advantages of servlets over these server side technologies are as follows:

• Persistent: Servlets remain in memory until explicitly destroyed. This helps in serving several incoming requests. Servlets establishes connection only once with the database and can handle several requests on the same database. This reduces the time and resources required to establish connection again and again with the same database. Whereas, CGI programs are removed from the memory once the request is processed and each time a new process is initiated whenever new request arrives.

• Portable: Since servlets are written in Java, they are portable. That is, servlets are compatible with almost all operating systems. The programs written on one operating system can be executed on other operating system.

• Server-independent: Servlets are compatible with any web server available today. Most of the software vendors today support servlets within their web server products. On the other hand, some of the server side technologies like server side JavaSricpt and ASP can run on only selected web servers. The CGI is compatible with the web server that has features to supports it.

• Protocol-independent: Servlets can be created to support any of the protocols like FTP commands, Telnet sessions, NNTP newsgroups, etc. It also provides extended support for the functionality of HTTP protocol.

• Extensible: Servlets being written in Java, can be extended and polymorphed into the objects that suits the user requirement.

• Secure: Since servlets are server side programs and can be invoked by web server only, they inherit all the security measures taken by the web server. They are also safe from the problems related to memory management as Java does not support the concept of pointers and perform garbage collection automatically.

• Fast: Since servlets are compiled into bytecodes, they can execute more quickly as compared to other scripting languages. The bytecode compilation feature helps servlets to give much better performance. In addition, it also provides advantage of strong error and type checking.



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Search Content