A review of Programming Jakarta Struts, by Chuck Cavaness (O'Reilly), with some side comments on Struts itself.
Summary: covers the ground, but it's heavy going to begin with.
I picked up Programming Jakarta Struts because I wanted to understand the Struts web application framework quickly, and O'Reilly's books are normally a lot better for this purpose than attempting to read the original documentation. In this case, although I think the book actually is easier to understand than the current Struts documentation, I don't think that it makes it as easy as it could be for a beginner to get to grips with the framework.
The book starts with two chapters that you might regard as review material if you already know about Servlets and JSP. However, in my opinion some aspects of these chapters are important in the context of Struts simply because Struts is very tightly based on a particular interpretation of the MVC (Model-View-Controller) pattern, of which Cavaness rightly says "there is much disagreement on the precise definition".
An "Overview of the Struts Framework" follows, which includes a simple worked example. What I was hoping for at this point in the book was what I might call a "Hello, Struts!" example; the kind of trivial case small enough to be typed in from the text and run to establish basic principles before going on to more advanced topics. The example provided is quite a bit more complicated than that, and not all of the source files and configuration files required are included; some are provided in fragmentary form while others are omitted entirely. You can download the whole example from the book's web site, but in my view this is much less satisfactory for two reasons:
In the case of Struts, I suspect from things I've read elsewhere that prior to Struts 1.1, it might have been difficult to put together a "Hello, Struts!" example of the kind I was hoping for. In particular, I've seen criticisms of Struts that it is too "code heavy", in other words that you need to write a lot of Java classes to make anything happen. This is not a valid excuse for Programming Java Struts, however, as it is explicitly marketed as "the most up-to-date book available" due to its coverage of Struts 1.1. I believe an opportunity has been missed here to make use of the new features in Struts 1.1 to provide an initial example simplified to a point where it could be presented entirely within the text.
Except for this concern about the example used, the overview is well handled. Most of the rest of the book deals with the major aspects of Struts development in a logical manner using a much larger example application, which is also available for download if you feel the need to fiddle with it. A chapter on performance issues is quite rare in this kind of book, and is therefore particularly welcome.
Appendices provided include a list of changes between Struts 1.0 and 1.1, the contents of which serve to indicate that Struts 1.1 is a big improvement on its predecessor in terms of simplifying development. I think that the book as a whole would have been improved by preferring to talk about the newer, simpler features first and the older, more general facilities later. For example, the original imperative
ActionForm class system is introduced in the initial example and described in great detail before the much simpler to use declarative
DynaActionForm facility is covered several chapters later. This is correct with respect to the class hierarchy, but that doesn't necessarily make it the right order in which to present the material: for the hierarchical view, we can always go to the Javadoc documentation.
Having read this book, I'm looking forward to evaluating Struts in some real projects, and I'll keep Programming Jakarta Struts around to help me as a bridge to the on-line reference material. As a beginner, though, I would have appreciated a gentler introduction to the complexities of Struts: perhaps an initial example with fewer forms, no validation and the use of
DynaActionForms instead of explicit classes would have fit the bill better.