Quintessential Reference on Servlet Programming

A classic in the making, most extensive servlet coverage anywhere, great examples, easy to read.


ORIGINAL DRAFT

O’Reilly has a knack for releasing books that easily become the best reference on the topics they cover. This book is one of those examples, covering everything other servlet books have covered, and going the extra mile to bring more practical information to bear on the problems encountered by developers working on real projects in the field. Having done my own share of servlet development, I found this book to be more than merely comprehensive. There were enough nuggets of information in there that I must, in all good conscience, elevate this book to the top of my servlet recommendation list.

No good servlet book can lay a foundation without covering the many advantages over CGI and native server extensions required to accomplish similar goals. Chapter 1, "Introduction", does just that, leading into Chapter 2, "HTTP Servlet Basics", to explore the basic mechanics and features like server-side includes, servlet chaining and JavaServer pages. The last of these is becoming part of the official Servlet API but has been around for some time, implemented by the Sun’s Java Web Server. Chapter 3 covers "The Servlet Life Cycle". Here’s where some of the insights start to surface, with clear explanations covering threading, content length and handling last modified times. These are the kinds of things that can lead developers to quick solutions - in my experience, things that took several days to discover without the benefit of these key fragments of information.

Chapters 4 and 5 approach the request-response paradigm in two parts. Chapter 4 covers "Receiving Information", everything from initialization to manipulating requested data structures. Chapter 5, "Sending HTML Information", looks at responses, their structure, status codes, headers and even persistent connection issues. I found Chapter 6 particularly interesting. "Sending Multimedia Content" explores an interesting approach to serving dynamic image content on the web, as well as compressed content.

Session Tracking is a powerful feature required to make it possible to implement application servers on top of standard HTTP servers. HTTP is a stateless, request-response, paradigm that can be extended to handle state through the servlet Session model. Chapter 7 is fully dedicated to this key set of capabilities. Chapter 8 looks at security issues. I found most of the information relevant but this is a complex area that requires extensive coverage. I would have liked to see secure connection examples explored but the coverage was sufficient to help most readers understand the basic principles and issues, as they relate to servlet programming.

No servlet book would be complete without the "Database Connectivity" coverage in Chapter 9. Performance is key to serving up millions of pages, an increasing number of which are dynamically generated from database information. This chapter helps the reader understand multi-tiered solutions and takes a practical look at connection pools. The author provides a simple implementation for handling connection pooling and goes further to explain that the session mechanism offers a powerful alternative, assigning a separate connection to each connected user. Like any approach there are limitations, but this is a serious bottleneck worthy of the attention dedicated to it in this book.

Chapters 10 and 11 look at "Applet-Servlet" and "Interservlet" communication, respectively. Implementing a simple Chat application to demonstrate a number of approaches. These approaches coexist and utilize direct socket, http tunneling and RMI communication channels. Chapter 11 covers interservlet issues and provides a number of interesting solutions. Chapter 13, "Internationalization", provides unique coverage in an area that is seldom touched on in any of the Java servlet literature. If you are developing multi-lingual client/server applications, this chapter alone may make the book worth buying. Chapter 13 wraps up the book with a look at "Odds and Ends", a collection of topics that did not fall under any of the other chapter headings.

If you do, or plan to do, any serious servlet development, or even if you are just evaluating the technology, you need this book. There are only a few servlet books available today. This is, without questions, the best of them. The authors clearly have real world, commercial experience developing servlet applications. This experience brings a number of issues to light, issues that require a great deal more discovery than reading, if you don’t have the benefit of this information. If you are serious about writing servlets, this book may well save you great deal of unnecessary development time. For that, and other reasons listed here, you would do well to put this book on your shelf.