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

Prefixes: prop and literal


If you look into the Tapestry online documentation at http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html, you will notice that a component's properties can have either a prop or literal default prefix. Say, the label property of the TextField component has the default prefix literal, while the value property of the same component has the default prefix prop. What does this mean?

Say we have provided the following value for the label property of some TextField component:

t:label="User Name"

Since the default prefix for this property is literal, Tapestry will take whatever we've specified literally, that is, the label for the component will be User Name. We could achieve the same result by using the prefix explicitly, but this simply means more typing:

t:label="literal:User Name"

However, if we wanted the label to be provided by the page class, we would need to explicitly use the prop prefix:

t:label="prop:theLabel"

In this case Tapestry...