Are you looking for that JavaServer Pages book that will get you started creating JSP-based Websites? In this article, I'll look at six of the latest JSP books offered. Those books include:
- Pure JSP: Java Server Pagesby James Goodwill (Sams, 2000)
- JavaServer Pagesby Larne Pekowsky (Addison-Wesley, 2000)
- Instant JavaServer Pagesby Paul Tremblett (Osborne McGraw-Hill, 2000)
- Web Development with JavaServer Pagesby Duane K. Fields and Mark A. Kolb (Manning Publications, 2000)
- Core Servlets and JavaServer Pagesby Marty Hall (Prentice Hall, 2000)
- Professional JSPby Dan Malks, et al. (Wrox Press, 2000)
Table 1 below provides a quick overview of the main characteristics of the reviewed books. I will go into more detail, reviewing each book individually, later in the article.
|Table 1: JSP Books Overview|
|Pure JSP||JavaServer Pages||Instant JavaServer Pages||Web Development with JavaServer Pages||Core Servlets and JavaServer Pages||Professional JSP|
|CD-ROM/Source from Web||No / No||Yes / No||Yes / Yes||No / Yes||No / Yes||No / Yes|
|Servlets/JSP Versions||2.2 / 1.1||2.2 / 1.1||2.1 / 1.0||2.2 / 1.1||2.2 / 1.1||2.2 / 1.1|
|Tag Extensions||None||Poor||Poor*||Very Good||Good||Good|
|API Reference||Very Good||None||Very Good||Average||None*||Very Good|
|Web Servers / Databases||Tomcat||PostgreSQL||Apache, JServ, PostgreSQL||Tomcat||Tomcat, JSWDK, Java Web Server||Apache, Tomcat|
|A star (*) in a field means this review provides further details of the ranking.|
The first group of rows in Table 1, up to Authors, should be fairly self-explanatory. The subsequent rows indicate the version or level of coverage that the books offer for each category. Here are some things to note:
- The Servlets API has gone from 1.0 to 2.0 to 2.1 and is now up to 2.2. The JSP API has gone from 0.91 (and earlier) to 0.92 to 1.0 to the current 1.1 version. Almost all the books cover the latest API version.
- For JavaBeans-JSP page connectivity coverage, I was primarily looking for use with jsp:useBean.
- The J2EE coverage is besides servlets, JDBC, and XML coverage.
- The API Reference shows the book's coverage of the
javax.servlet) API documentation. Personally, I have never needed to look at the
javax.servlet.jspAPI reference. For clarity, I should mention the API reference is not the list of implicit objects and JSP directives. I mean API documentation on the
- As for Web servers/databases, just mentioning a server in the book is not sufficient to be listed here. Basically, instruction on how to configure the Web server or add a JSP file/Web application to the Web server is necessary and/or how to set up/use the database server.
Before starting the reviews, one thing I should mention is that I am the author of one chapter in Professional JSP (Wrox Press). Given the small contribution I made to Professional JSP, I feel I can still give an objective overview of that book and the others. Since it is clearly not my favorite book, I hope you can feel the same.
In the rest of this article, I'll review each book individually. Beside each book's title is a star rating, which is based on the book's overall coverage of JavaServer Pages. One star is equivalent to a poor rating, and the highest rating (five stars) translates to exceptional coverage.
Pure JSP: Java Server Pages(4 stars)
I rarely find books published by Sams that I like, but I'm happy to say that I found an exception. While Pure JSP: Java Server Pages by James Goodwill is the smallest of the JSP books, I found the JSP coverage to be very succinctly written and nearly complete. The main missing component was how to create custom tag libraries. Goodwill starts with a conceptual overview of JSP and how it fits in with Servlets, JavaBeans, and JDBC. He also includes techniques for handling errors, working with the implicit objects, using standard actions, communicating with JavaBeans, communicating with a database through a connection pool, using the SAX parser with XML, and sending mail with the JavaMail API. While none of the chapters is extensive or in-depth, the book's content is more than sufficient to get you started with JSP.
Given the book's small size, I was surprised to see the last third of the book taken up on the API reference. You can locate the source code for Pure JSP from the Sam's Website (see Resources). One other minor note: Pure JSP is the only book in which the title had the improper usage of Java Server in JavaServer Pages.
JavaServer Pages(2 1/2 stars)
JavaServer Pagesby Larne Pekowsky is geared to the Web designer instead of the Java developer (unlike Pure JSP). You'll find an introduction to creating dynamic content, the Java programming language, and writing JavaBeans as well as an introduction to JDBC. You get to use JavaBeans before you learn how to create them, and you have to pull the source/class files from the CD in order to use the examples. Unfortunately, Pekowsky does not show how to set up the Web server or the JDK in order to create a JSP page, compile a Java class, or show where to put the bean class. A reference to documentation about configuring Tomcat is on the companion CD, though it is terse. Basically, Pekowsky has you unzip a zip file but does not allow you to create anything yourself.
In learning about all those technologies, JavaServer Pages takes you through the development of a fictional Slashdot-like Website called Java News Today, increasing the amount of supported dynamic content along the way. In developing Java News Today, Pekowsky doesn't provide the typical JSP coverage of items such as implicit objects and directives. In fact, no list of implicit objects exists anywhere, and the JSP tag list is relegated to an appendix.
The rest of the book seems to jump around with different topics, with lots of SQL code to setup tables for the examples. For readers, I found many of the descriptions confusing or insufficient. If you are interested in using JSP to add JavaBeans to your Webpages, then this book will show you how; otherwise, I wouldn't bother reading it for anything else.
Instant JavaServer Pagesapproaches its teaching of JSP in a manner between that of Pure JSP and JavaServer Pages. You get a verbose description of what JSP is and how you can use it, followed by a description of syntax with everything from page directives to implicit objects, sessions, and error pages. Beyond the introduction are eight chapters covering typical JSP Web applications, teaching you JSP fundamentals along the way. Those include a login manager, FAQ database, telephone directory, electronic postcard sender, and many more. Knowing each of those fundamentals, you can easily extend an existing Website. The XML example is a little weak; it just generates the XML but doesn't parse anything.
Instant JavaServer Pagesalso includes extensive installation instructions for Linux of Apache, JServ, and PostgreSQL. That reveals the book's shortcoming -- it is the only JSP book that describes the quickly outdated JSP 1.0 specification. That means the description of functionality such as tag extensions is preliminary and only utilizes the Servlets 2.1 API version. Despite that shortcoming, the book is overall a good learn-by-example approach to JSP.
Web Development with JavaServer Pages(5 stars)
Web Development with JavaServer Pagesfrom Manning Publications is definitely for the higher-end Java developer. Web designers will also find it useful if they just ignore the latter half of the book. Authors Duane Fields and Mark Kolb start with the typical introduction to JavaServer Pages, comparing it to other dynamic content technologies. In addition, they go into more detail with tasks such as separating presentation from implementation to achieve division of labor.
Following the introduction, Fields and Kolb provide an in-depth look into JSP syntax, from beans and session management to directives, actions, and implicit objects. While most of the other JSP books give a cursory overview of those elements, Web Development with JavaServer Pages tries to be more useful, offering more in-depth coverage such as a table of the methods for each of the implicit objects.
And, with the JavaBean integration description, you get more than just how to use the
jsp:useBean syntax but also a nice discussion of the JavaBeans component architecture and, for the very beginner, how to use indexed properties from JSP.
Chapter 6 is where the book seems to be more focused on the Java developer rather than the Web designer. It offers a look into creating JavaBean components with the JavaBean event model as well as with bound and constrained properties. The JDBC with JSP and connection-pooling discussion also includes little extras such as using JNDI to look up the data source. There is even an example of using a
CachedRowSet to spread the query results across multiple pages. You also get a FAQ database application and instructions on how to deploy it as a Web application with the J2EE deploy tool.
If that's not enough, Fields and Kolb also cover performing common tasks such as cookie management, JSP error handling, sending email with the JavaMail API, as well as generating XML. There are also two chapters on working with custom tag libraries from construction to packaging and many tasks in between. The appendices include Tomcat installation instructions and help you incorporate applets into JSP pages. The only thing I found missing in the book was a typical JSP-based shopping cart.
Given the title of Core Servlets and JavaServer Pages, I wasn't sure if I should include it in the review. It's a good book, but it's not the best for just learning about JavaServer Pages, especially since JSP coverage doesn't begin until Chapter 10. It is an excellent book for the Java developer to learn about servlets, how to use JSP pages with servlets, and how to connect servlets to a JDBC backend. It's just not for someone strictly interested in learning about JavaServer Pages; hence I didn't rate it as a JSP learning resource.
With that said, how is the JSP coverage? Author Marty Hall provides sufficient JSP coverage for the Java developer but definitely not the depth of coverage offered in Web Development. You'll find the typical descriptions of scripting elements, directives, and JavaBeans support. There's a decent chapter on creating a custom JSP tag library and a nice chapter on integrating JSP pages with servlets. That's really it for JSP coverage. The rest of the book focuses more on servlet-specific content. For instance, the JDBC examples are purely servlet-driven, with no discussion of JDBC with JSP.
The appendix offers a quick reference that is a combination syntax card, partial API reference, and certification exam study resource.
Had the book been available when I reviewed servlet books in "Java servlet books: A comparative review", I would have recommended it over Java Servlet Programming by Jason Hunter, primarily because it covers the latest version of the Servlets API.
Professional JSP(4 stars)
The final entry in this comparative review of JSP books comes from Wrox Press with a whopping 21 different authors, myself included. In short, Professional JSP seems to fall somewhere below Web Development and above Pure Java in terms of depth of JSP coverage. While lacking some depth, it tries to make up for it in breadth of topics covered, including WAP/WML, JMF, and XML parsing as well as several in-depth case studies. In addition, with 21 different authors, it seems as if there are at least 21 different runtime environments, which lets you experiment with many different environments. And you'll be able to see 21 different coding styles.
The book starts with the typical introduction to JavaServer Pages and a comparison to dynamic content technologies available on the Web. Following the introduction is an overview of JSP syntax from directives to actions and implicit objects. Nothing is too elaborate and the implicit objects just reference what object from the Servlet API they represent, but not what you can do with them.
The chapter on JSP and JavaBeans spends more time describing the JavaBeans specification and mentions nothing about the different scopes when using the
jsp:useBean tag. It does, however, introduce a JDBC connection pool, with a different one described more fully in the later chapter on JDBC integration. The discussion of servlet sessions and custom tag libraries is sufficient. There's even a nice chapter on debugging your JSP applications.
About a third of the way into the book, the focus seems to change from teaching the reader JavaServer Pages to showing how he or she can use it: from architecting a Web application that uses JSP, JavaBeans, and servlets to several case studies that utilize the different components of J2EE. Unlike Instant JavaServer Pages, where the Web applications were small-scale apps, you can easily plug into an existing environment. The case studies look into some serious large-scale enterprise solutions, some going from design through implementation. The different case studies discuss some of the other Java APIs and third-party products such as those that serve images through JSP pages, using JNDI and EJB, and working with the iPlanet server instead of Tomcat. There are even case studies on streaming data with JSP, working with the Wireless Application Protocol (WAP) to serve JSP pages to devices other than a browser, and porting your ASP Website to JSP.
Which book should you buy?
For the right audience, you can't go wrong with most of those books.
I see JavaServer Pages primarily for the frontend developer, not for the Java programmer. While some things practically require Java code within the JSP page, the amount should be minimized. You shouldn't need to be a Java developer to create JSP pages.
With that said, for both the Web designer and the Java developer interested in picking up JSP skills, I think Web Development with JavaServer Pages from Manning Publications is the best offering, head and shoulders above the rest. It provides excellent insight into where to put what and how to put it there. None of the other JSP books offer the same depth of coverage on the different JSP topics.
Pure JSP: Java Server Pagesis a great, inexpensive quick start to JSP, though once you start using JSP seriously, you'll need something more substantial. Hall's Core Servlets and JavaServer Pages is fine for those interested in starting to develop servlets and who also want to pick up some JSP knowledge. If you are an ASP developer, you'll like the extra help in Professional JSP. If Instant JavaServer Pages wasn't based on the JSP 1.0 specification, I would like it more; however, it does include some nice pluggable JSP Web applications you can incorporate right into any Website.
Learn more about this topic
- Pure JSPJava Server Pages,James Goodwill (Sams, June 2000) with source code
- JavaServer Pages,Larne Pekowsky (Addison-Wesley, 2000) no source code
- Instant JavaServer Pageshomepage
- Web Development with JavaServer Pages,Duane K. Fields and Mark A. Kolb (Manning Publications, April 2000)
- Core Servlets and JavaServer Pages,Marty Hall (Prentice Hall, May 2000)
- Professional JSPdownload site
- jGuru's JSP FAQ
- The Jakarta Project's Tomcat homepage
- Sun's JSP homepage
- "Java Servlet BooksA Comparative Review," John Zukowski (JavaWorld, March 2000)