Prev | Current Page 140 | Next

Alexander Kolesnikov

"Tapestry 5: Building Web Applications"


I guess you are a little bit puzzled now by all those different prefixes, so let's discuss
them properly.
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 will look for the getTheLabel method in the page class and use
whatever that method returns as the label.


Pages:
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
życzenia alufelgi poznań dieta light Zjeżdżalnie dla dzieci warszawa śmieszne dowcipy