Chapter 18. JavaServer Pages

JavaServer Pages, commonly known as JSP, is a technology created by Sun Microsystems and closely tied to servlets. JSP was one of the first efforts to create a non-proprietary servlet-based content creation system. If you’ve been following servlets long, you may remember JSP was first announced in the spring of 1998—early enough in fact for the first edition of this book to include a short tutorial on JSP’s prerelease 0.91 version. Of course, JSP has changed significantly since then. In this section, we cover JSP 1.1, built on top of Servlet API 2.2.

As with servlets, Sun releases a JSP specification (created by an expert group consisting of outside vendors and individuals), and then third-party vendors compete on their implementation of that standard. Unlike the other technologies discussed that build on top of pure servlets, JSP is a specification, not a product, and requires support from the server in order to work. Most servlet container vendors are providing this support, including Tomcat where the JSP engine is named Jasper and JSP is a core component of Java 2, Enterprise Edition ( J2EE).

One stated purpose of JSP (quoting from the specification) is to “enable the separation of dynamic and static content.” Another purpose is to “enable the authoring of Web pages that create dynamic content easily but with maximum power and flexibility.” JSP accomplishes both of these goals fairly well. However, because of the “maximum power” ...

Get Java Servlet Programming, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.