SHARE
Facebook X Pinterest WhatsApp

Servlets and JSP: An Overview Page 2

Jul 20, 2010
ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More



What Are the Advantages of Servlets Over Traditional CGI?

  • Convenient. Hey, you already know Java. Why learn Perl too? Besides the convenience of being able to use a familiar language, servlets have an extensive infrastructure for automatically parsing and decoding HTML form data, reading and setting HTTP headers, handling cookies, tracking sessions, and many other such tasks.
  • Powerful. Java servlets let you easily do several things that are difficult or impossible with regular CGI. For one thing, servlets can talk directly to the Web server (regular CGI programs cannot). This simplifies operations that need to look up images and other data stored in standard places. Servlets can also share data among each other, making useful things like database connection pools easy to implement. They can also maintain information from request to request, simplifying things like session tracking and caching of previous computations.
  • Portable. Servlets are written in Java and follow a well-standardized API. Consequently, servlets written for, say iPlanet Enterprise Server can run virtually unchanged on Apache, Microsoft IIS, or WebSTAR. Servlets are supported directly or via a plug-in on almost every major Web server.
  • Inexpensive.Various free or very inexpensive Web servers available are good for “personal” use or low-volume Web sites. But with the major exception of Apache, which is free, most commercial-quality Web servers are relatively expensive. But once you have a Web server, no matter the cost of that server, adding servlet support to it (if it does not come preconfigured to support servlets) is usually inexpensive or even free.

    Servlets are Java technology’s answer to CGI programming; JSP is a technology that lets users mix regular, static HTML with dynamically-generated HTML. This tutorial discusses the basics of Java Servlets and JSP, and the advantages of using each of these technologies.

    Next: What Is JSP?


Recommended for you...

What Is a Container? Understanding Containerization
What Is a Print Server? | How It Works and What It Does
Nisar Ahmad
Dec 8, 2023
What Is a Network Policy Server (NPS)? | Essential Guide
Virtual Servers vs. Physical Servers: Comparison and Use Cases
Ray Fernandez
Nov 14, 2023
ServerWatch Logo

ServerWatch is a top resource on servers. Explore the latest news, reviews and guides for server administrators now.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.