Chapter 4. Tapestry Components - A Primer

Table of Contents

4.1. Implicit and Explicit Component Usage
4.1.1. Component Declaration in Templates
4.1.2. Component Declaration in Specifications
4.2. Parameters and Bindings
4.2.1. Dynamic Binding
4.2.2. Static Binding
4.2.3. Message Binding
4.2.4. Inherited Binding
4.2.5. Listener Binding
4.3. Parameter Directions
4.4. Formal and Informal Parameters
4.5. Reserved Parameters
4.6. Component Copies
4.7. Enclosing Components
4.8. Tapestry Pages
4.9. Components State
4.9.1. Transient Properties
4.9.2. Persistent Properties

Components are building blocks used to build other components including a web page. These building blocks can be nested to form a hierarchy of container and contained components. This hierarchy is captured in fragments within every component that is a part of the hierarchy. Every component holds a reference to its containing component and a reference map to its contained components.

Contained components, often known as embedded components, always render within the context of their containing component and contribute to their immidiate containing component.

[Note]Note
Web pages are top level components that can only serve as containers and never be embedded within another component.

Component definitions typically involve a template, a specification and a JavaBeans class. Although components can be defined just from a template or from a specification and a JavaBeans class.

Components that do not have a template are called primitive components. These components generate any markup that needs to be rendered from within the component class. Most framework components are primitive components.

Component Definition. 

<component-specification 1 class="..." 2 >
    ...
</component-specification>

1

The root element of a component specification. It identifies the defining component as a non-page, meaning embeddable, component.

2

The component class. This class is one of either the framework classes, AbstractComponent or BaseComponent, or a user-defined subclass of one of these framework classes.

There is a lot involed in component definitions. We'll cover them in detail later.