Using a Parameter The most natural solution for displaying a page-specific title is to pass this title to the Border component as a parameter, and this is very easy to do. First of all, let's prepare the component's template to display the title:
Celebrity Collector: ${pageTitle} href="${asset:context:/assets/styles.css}" type="text/css"/> ??¦ Creating Custom Components [ 204 ] Next, we need to define the parameter in the component class. Add the following lines of code to Border.java: @Parameter(required = true, defaultPrefix = "literal") private String pageTitle; public String getPageTitle() { return pageTitle; } The parameter is defined as mandatory here, which probably makes sense. If it is not provided to the component, Tapestry will throw an exception. However, we could also define it as optional and then perhaps provide a default value, like this: @Parameter private String pageTitle = "Default Title"; Also, we have defined that the default prefix for this parameter is literal, otherwise it literal, otherwise it will be prop. Finally, we need to add this parameter to the Border component on all pages. Here is how it will look for the ShowAll page, as an example: t:pageTitle="All Celebrities in Collection" xmlns:t="http:// tapestry.