ServersServlets and JSP: An Overview Page 2

Servlets and JSP: An Overview Page 2

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?


Get the Free Newsletter!

Subscribe to Daily Tech Insider for top news, trends & analysis

Latest Posts

Related Stories