Book Image

Tapestry 5: Building Web Applications

Book Image

Tapestry 5: Building Web Applications

Overview of this book

Table of Contents (17 chapters)
Tapestry 5
Credits
About the Author
About the Reviewers
Preface
Foreword
Where to Go Next

How to Create a Tapestry 5 Component


In fact, components in Tapestry 5 are very similar to pages. They can have a template that looks pretty similar to a Tapestry page. The component's Java class is a POJO, just like a page class. In this class, we can inject different resources and services, create event handlers and so on—anything we would normally do in a page class.

The difference between a page and a component is that components often have parameters—pieces of information passed to them to influence their appearance and functionality. Also, page classes are always created in the pages sub-package of the application's package structure. Whereas component classes always go into the components sub-package, and their templates should be placed into this sub-package as well (or, more precisely, the templates should be placed under the same structure of subdirectories as component classes).

There can also be components without templates. If they need to display themselves in some way, they...