Chapter 1. Introduction

Table of Contents

An overview of Tapestry
Pages and components
Engines, services and friends
Object Graph Navigation Language

Tapestry is a component-based web application framework, written in Java. Tapestry is more than a simple templating system; Tapestry builds on the Java Servlet API to build a platform for creating dynamic, interactive web sites. More than just another templating language, Tapestry is a real framework for building complex applications from simple, reusable components. Tapestry offloads much of the error-prone work in creating web applications into the framework itself, taking over mundane tasks such as dispatching incoming requests, constructing and interpretting URLs encoded with information, handling localization and internationalization and much more besides.

The "mantra" of Tapestry is "objects, methods and properties". That is, rather than have developers concerned about the paraphanlia of the Servlet API: requests, responses, sessions, attributes, parameters, URLs and so on, Tapestry focuses the developer on objects (including Tapestry pages and components, but also including the domain objects of the application), methods on those objects, and JavaBeans properties of those objects. That is, in a Tapestry application, the actions of the user (clicking links and submitting forms) results in changes to object properties combined with the invocation of user-supplied methods (containing application logic). Tapestry takes care of the plumbing necessary to connect these user actions with the objects.

This can take some getting used to. You don't write servlets in Tapestry, you write listener methods. You don't build URLs to servlets either -- you use an existing component (such as DirectLink) and configure its listener parameter to invoke your listener method. What does a listener method do? It interacts with backend systems (often, stateless session EJBs) or does other bookkeeping related to the request and selects a new page to provide a response to the user ... basically, the core code at the center of a servlet. In Tapestry, you write much less code because all the boring, mechanical plumbing (creating URLs, dispatching incoming requests, managing server-side state, and so forth) is the responsibility of the framework.

This is not to say the Servlet API is inaccessible; it is simply not relevant to a typical Tapestry user.

This document describes many of the internals of Tapestry. It is not a tutorial, that is available as a separate document. Instead, this is a guide to some of the internals of Tapestry, and is intended for experienced developers who wish to leverage Tapestry fully.

Tapestry is currently in release 3.0, and has come a long way in the last couple of years. Tapestry's focus is still on generating dynamic HTML pages, although there's plenty of support for XHTML, WML and other types of markup as well.

Nearly all of Tapestry's API is described in terms of interfaces, with default implementations supplied. By substituting new objects with the correct interfaces, the behavior of the framework can be changed significantly. A common example is to override where page and component specifications are stored (perhaps in a database).

Finally, Tapestry boasts extremely complete JavaDoc API documentation. This document exists to supplement that documentation, to fill in gaps that may not be obvious. The JavaDoc is often the best reference.