In a continuation of my series of articles about Java Web development frameworks, this article will look at the Tapestry framework. Because Tapestry is a rather large framework, one article is not enough to cover most of its features. I decided to split the discussion about Tapestry into two parts. In this first part, I will focus on the configuration of the framework in an enterprise-level IDE such as JBuilder 2006 and prepare the groundwork for a working example in the second part. I will also describe the structure of the framework and its main features in this article, and concentrate on more specific features and details in the second part.

Background of Tapestry

Tapestry is an open-source framework for Web development written in Java. It competes with other frameworks such as Struts, WebWork, and Turbine to be the first choice of Web developers as an application framework. It was developed by Howard Lewis Ship and is part of Jakarta project at Apache Software Foundation.

Tapestry is not like the other Web development frameworks, not only in terms of its structure and APIs but also in terms of the development process. It uses a component object model to represent the pages of a Web application. Working with Tapestry feels more like developing a desktop application with Graphical User Interface (GUI) widgets or java Swing components. Under the hood framework is written cleverly enough to make coding a Web application feel as a desktop application development. The framework does a tremendous amount of work behind the scenes and hidden from the developers, such as object pooling, multi threading, listener callbacks, garbage collections, session state, rendering, and other processes.

At first glance, Tapestry may appear to be overly complex and resource intensive; however, it actually is not. Most of the components are cached or reused and structure is intuitive for any developer who has worked with Swing or a similar GUI toolkit. The framework also uses XML intensively.

Tapestry implements the Model-View-Controller (MVC) paradigm not only for the overall separation of logic and presentation at the framework level, but also on the level of its individual components such as tables or forms, as I will explain in the next section. Additionally, numerous main components are implemented in terms of public interfaces to give developers a great deal of flexibility in using the framework.

Tapestry also offers a built-in logging mechanism that is excellent. It is extremely flexible and provides a wealth of information.

Here is a short description of the framework from the Apache site:

Tapestry reconceptualizes Web application development in terms of objects, methods, and properties instead of URLs and query parameters.

Tapestry is an alternative to scripting environments such as JavaServer Pages or Velocity. Tapestry goes far further, providing a complete framework for creating extremely dynamic applications with minimal amounts of coding.

Tapestry’s approach, using a component object model similar to a traditional GUI, provides the following benefits:

  • Very high level of reuse, within and between projects

    Everything in Tapestry is a reusable component
  • Frees developers from writing boring, buggy code

    Code in terms of objects, methods, and properties, not URLs and query parameters
  • Allows applications’ complexity to scale well

    Framework does all the URL building and message dispatching, transparently
  • Easy Internationalization/Localization

    Framework selects localized version of text, templates, and images
  • Extremely robust applications

    Less code is less bugs

    Sophisticated built-in exception reporting

    Line precise error reporting
  • Easy team integration

    Graphic designers and Java developers can work together without having to know each other’s jobs

Tapestry components are a combination of a specification file (in XML), an HTML template, and a Java class (extending a framework class, with simple additions). Tapestry components are combined together to form larger components or complete Tapestry pages.