by Larne Pekowsky|
Cover price: US$44.99
This second edition of JavaServer Pages offers an excellent introduction to using JSPs to build dynamically driven Web pages. The book covers topics appropriate for both novices and experienced users, and both amateurs and professionals. It is scoped for both Web designers proficient with HTML and Java programmers hoping to gain insight into Web development. In addition to covering topics such as the JSP standard tag library and database access, the book includes a chapter on basic Java coding for beginners. More advanced practitioners will find material on topics such as creating your own tag libraries and Struts, a technology for building on top of JSPs. However, I do have one caveat for the novices: To get full value from JSPs, you will need more Java knowledge than this book provides.
JavaServer Pages opens with an introduction providing "A Brief History of the Web"; much of this will be old hat to most readers, but the introduction also includes an excellent overview of other technologies that you can use to create dynamically driven Web sites. This section provides enough context to help readers understand the motivations and decisions behind the JSP specification design.
After the introduction, Pekowsky dives straight into JSP basics with a chapter on "Simple JSPs." Like most subsequent chapters, the examples here center around creating a fictional Web site called Java News Today, which features "compelling, up-to-the-minute news" about "all things Java." This example site provides an excellent mechanism for explaining how to apply different techniques in a real-world scenario. It also provides enough guidance for readers to implement the Java News Today site themselves as they move from chapter to chapter, building on tips and techniques from previous chapters as they proceed. This opening chapter, for example, introduces readers to basic JSP tags used in the example Web site.
The next chapter covers the heart of JSPs: beans. Using an example, Pekowsky shows what a bean is, how to create one, and how to access that bean from a JSP page. Then, he uses beans to upgrade the Java News Today Web site.
After touching on the standard tag library in previous chapters, Pekowsky finally introduces the library in Chapter Four, which covers several important techniques, including:
- Assigning dynamic attributes in tags.
- Displaying expressions.
- Formatting output.
- Detecting browsers.
- Repeating a section of a page.
The book provides more detail about these standard tags and many more in an excellent appendix. This volume can serve as a reference after you've learned about JSPs ? or as a tutorial for those with minimal tag knowledge.
Pekowsky discusses another topic of interest to hobbyist developers: databases. Dynamic Web pages are of little use without a back end full of data to represent, and this book explains how to integrate database calls into JSP pages. First it discusses basic SQL syntax, and then how to leverage the standard tag library for reading and writing to a database directly from a JSP. It also covers populating JavaBeans from the database. In addition, many pages focus on adding database support to the Java News Today example Web site. Unfortunately, I think novice users will struggle with SQL even after reading these chapters; the few pages of SQL syntax they provide will not help readers learn much about this complex topic.
Pekowsky also could have devoted more space to helping novice users set up a Web server and database server. These are essential steps for using JSPs, but they have been relegated to the CD included with the book. Also, given the database server that's on the CD, I am not sure novice SQL users will be comfortable venturing beyond the book's examples and trying variations on their own. Although teaching readers how to use a Web server or database server effectively might be outside the scope of this book, these skills are necessary for getting JSPs to display database-driven content in the way the book describes. But this is a small complaint ? in truth, abundant information on these topics is available online.
Chapters on more advanced topics are devoted to XML, beans, servlets, controllers such as Struts, and creating tag libraries. Novice programmers will be interested in a chapter devoted to Java programming. All chapters cover their topics well, but a lot of this material is in the "nice to know" category. This is not really a criticism: Many readers will come back to these later chapters as their JSP knowledge grows, and the book's value extends beyond an initial reading.
The book contains another useful appendix: This one offers advice on configuring a Web application. Although it provides enough information to get readers up and running, it does not supply enough to help novices through the frustration of trying to configure a Web application.
Despite the few shortcomings I've mentioned, this book provides a wonderful jumpstart for the novice JSP user as well as enough information on advanced topics to keep the gurus coming back to it. Although it is skimpy on some technical details, the book more than makes up for this with a thoughtful, detailed analysis of all the important concepts and techniques of modern JSP programming.