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

Another Use of PageLink Component


First of all, replace the ActionLink component in the ShowAll.tml template with PageLink, and specify the page to which this link should lead. You can also remove the t:id attribute as it will be not needed anymore. The component definition should look like this:

<a href="#" t:type="PageLink" t:page="Details"
t:context="celebrity.id">
${celebrity.lastName}
</a>

Remove or comment out the onShowDetails event handler method, it is not needed either. Add the onActivate method to the Details class with the following contents:

void onActivate(long id)
{
celebrity = dataSource.getCelebrityById(id);
}

You will also need to provide access to the data source ASO and remove the @Persistent attribute from the celebrity property:

@ApplicationState
private MockDataSource dataSource;
private Celebrity celebrity;

Finally, run the application and repeat the experiment. On the ShowAll page, click on the last name of some celebrity to see his or her details. Note...