Tapestry is a comprehensive web application framework for the Java programming language. Tapestry is based on components, highly reusable building blocks that can be quickly and easily combined to form pages within your application. By using and reusing components, and creating your own components, you can create richly interactive, robust applications with only a modest effort.
Tapestry?s basic style is to break problems into smaller and smaller units; this complements a team development environment where different developers work on different parts of the application. The framework makes it easy for both Java and HTML-only developers to work together without accidentally undermining each other?s work.
When building a web application with any technology, you will be faced with a constant stream of questions: How do I figure out what the user has requested? Where can I store this bit of information? How can I safely add this new functionality? How can I make my application scale? In too many environments, it?s easy to make the wrong decision when confronted with any of these, and many other, development-time questions. It?s too easy to take a quick-and-dirty detour down the wrong path, which ultimately comes back to bite you when you are least prepared to deal with it.
The central goal of Tapestry is to make the easiest choice the correct choice. Over the course of this book, we?ll show you how to build applications using Tapestry, but we will also show you the hidden traps and tangles that Tapestry helps you to avoid.
This is a book about getting things done using the Tapestry framework; as such, it will appeal to Java web developers looking for a better, easier way to build web applications. Because Tapestry is explicitly designed to support team development of web applications, this book will also be of interest to managers looking for a better way to leverage their team?s efforts.
This book is targeted at people who have at least gotten their feet wet in terms of Java web application development (or perhaps have already taken the full plunge). Therefore, we assume that you are at least somewhat acquainted with a number of concepts and technologies. Obviously, an understanding of the Java programming language is a prerequisite, as well as familiarity with such key Java APIs as the collections framework. You should also be clear on the distinction between Java interfaces and Java classes.
Much of Tapestry concerns the moving of information from one object to another; this is facilitated using JavaBeans properties. The core concept of the JavaBeans framework is that an object can be treated as if it was a Map, as a collection of named properties that can be read or updated without knowing the actual class of the object. More information about JavaBeans is available at http://java.sun.com/products/javabeans/docs/.
You should be familiar with the basic set of HTML tags, including <body>, <img>, <a>, <form>, and <input>. You must also be familiar with URLs and query parameters and the difference between HTTP GET and HTTP POST.
Many of the artifacts of a Tapestry application are XML documents. You should be familiar with basic XML usage and syntax.
Some of the later examples show how to implement client-side logic. This requires an understanding of JavaScript (the scripting language that executes within a client web browser) as well as the Document Object Model, the data structure representing a web page inside a web browser.
This book includes copious examples, which include all the Tapestry application artifacts: Java code, HTML templates, and XML specification files. Source code in listings or in text is in a fixed width font to separate it from ordinary text. Additionally, Java method names, component parameters, object properties, and HTML and XML elements and attributes in text are also presented using fixed width font. Java method names will generally not include the signature (the list of parameter types).
Java, HTML, and XML can all be quite verbose. In many cases, the original source code (available online) has been reformatted, adding line breaks and reworking indentation, to accommodate the available page space in the book. In rare cases, even this was not enough, and listings will include line continuation markers. Additionally, comments in the source code have been removed from the listings.
Code annotations accompany many of the source code listings, highlighting important concepts. In some cases, numbered bullets link to explanations that follow the listing.
Tapestry is an open-source project, released under the very liberal Apache Software License. Directions for downloading Tapestry, in source or binary form, are available from the Tapestry home page: http://jakarta.apache.org/tapestry/. Documentation available from the home page also identifies how to download the source code via CVS so that you can build the framework locally, if you are so inclined.
The Tapestry distribution includes the Virtual Library application described in chapters 9 and 10.
The source code for all examples in this book is available from Manning's web site: www.manning.com/lewisship/. To run the examples, you need to download Tapestry and the Tomcat servlet container. Appendix B contains the details.
The purchase of Tapestry in Action includes free access to a private web forum run by Manning Publications, where you can make comments about the book, ask technical questions, and receive help from the author and from other users. To access the forum and subscribe to it, point your web browser to www.manning.com/lewisship. This page provides information on how to get on the forum once you are registered, what kind of help is available, and the rules of conduct on the forum.
Manning?s commitment to our readers is to provide a venue where a meaningful dialogue between individual readers and between readers and the author can take place. It is not a commitment to any specific amount of participation on the part of the author, whose contribution to the forum remains voluntary (and unpaid). We suggest you try asking the author some challenging questions, lest his interest stray! The Author Online forum and the archives of previous discussions will be accessible from the publisher?s web site as long as the book is in print.
Howard Lewis Ship is the lead developer for the Tapestry project. He cut his teeth writing customer support software for Stratus Computer, but eventually traded PL/1 for Objective-C and NextStep before settling into Java. Howard is currently an independent open-source and J2EE consultant, specializing in customized Tapestry training. You can find Howard on the web at http://howardlewisship.com. In the real world, he lives in Quincy, Massachusetts, with his wife Suzanne, a novelist.