Summary

Definitions

Overview

Illustration 1
   -Page Template
   Page Specification
   Page Class
   Application Specification
   web.xml

Illustration 2

Illustration 3

The Framework - a flyby

Conclusion

Biography

Resources

Page Template
<html>
    <head>
        <title>Welcome to Tapestry!</title>
    </head>
    <body>
        Hello <span jwcid="user">User Name</span>! Welcome to Tapestry!
    </body>
</html>
Listing 1. Home.html
The template is the part where the static portions (plain text/HTML) of the web page needs to be provided, that will be rendered by Tapestry unaltered. In addition to providing the static portions of the page, the template is also used to provide placeholder tags for the dynamic portions of the page. The placeholder tags are XML-like (no scripting here!); in other words every open tag should have a matching close tag. The placeholder tags are identified by a unique user-provided id specified using a special markup tag attribute, jwcid, as shown in the <span> tag in our example template. It is the jwcid attribute of the placeholder tag that is of importance to Tapestry; the placeholder tag itself is irrelevant, it could have as well been <xyz> in our example. But the <span> tag was chosen instead, so the page can be previewed properly outside the context of a Tapestry application. The jwcid attribute instructs Tapestry that an instance of a JWC, declared in the specification below, is to be created and plugged in place of the placeholder tag. The placeholder tag can have attributes other than jwcid. How Tapestry interprets and treats these attributes is dependent on the specification of the component that will be plugged in. Some components (like the one we have used in our Home Page) instruct the framework to silently filter out the irrelevant attributes of the placeholder tag and its enclosing body when it is rendered. Thus our user JWC, when rendered, will not render the text "User Name" enclosed by the placeholder tag. Please see "Tapestry Component Reference" under "Documentation" on Tapestry's home page for more information on the core component specifications. In any case, the newly created instance of JWC is assigned the user-specified id (user in our example) that may be used later to reference this JWC. The template, as one can see, is for the most part plain HTML except for the XML-like placeholder tags. This allows a page designer with no programming knowledge, a more natural undertaker of the task to build and maintain web pages, to easily take over the responsibility of building and maintaining the template through the life of the application.
The naming convention for templates is the name of the component with a .html extension. And thus the template for our Home Page component is named Home.html. Templates are typically placed under the web application context. So, if Welcome is the context of our Welcome application, Home.html will typically be placed under webapps/Welcome.
<< Previous Next >>