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

Page Template and Page Class


One of the most discussed problems of web development, and perhaps of software development in general, is how to separate presentation (what is being shown to the user) from business logic (what happens behind the scenes). In Tapestry, this separation is achieved cleanly and easily as every Tapestry page has a template and a page class.

A page template is an XML document—something quite similar to a basic XHTML or an HTML file but written to strict XML rules, and with a few elements not available in XHTML. As you already know from the previous chapter, Tapestry page templates have a .tml extension (which is for Tapestry Markup Language). A Template must be a well-formed XML document, which means that every element must be either declared as empty or properly closed (say, you can have<img src=""/> or<img src=""></img>, but not just<img src="">), and all attributes' values must be enclosed in quotation marks.

We have already seen a Tapestry...