SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 130 | Next

Alexander Kolesnikov

"Tapestry 5: Building Web Applications"

detailslink/4
The number 4 at the end of the URL is exactly the value of the ID of the fifth
celebrity. When you click on the link, Tapestry will check if there is any method in
the page class that is assigned as an event handler for that link, and it will find the
following method:
@OnEvent(component="detailsLink")
Object onShowDetails(long id)
{
Celebrity celebrity = dataSource.getCelebrityById(id);
detailsPage.setCelebrity(celebrity);
return detailsPage;
}
You see that this method accepts a parameter of the type long??”exactly the type of
the id property of the Celebrity class. So Tapestry will take the ID of the selected
celebrity which is embedded into the link, and pass it as a parameter to the event
handler. As a result, we shall have an opportunity to retrieve the desired Celebrity
object from the data source and pass it to the Details page.
Simple Components
[ 102 ]
It is the time to complete the Details page properly. Here is what it should look like
at run time:
Right now, the occupation of a celebrity is displayed verbatim, as a value
of the Occupation enumeration. Values of an enumeration are constants,
and in Java, constants are named in all capitals by convention.


Pages:
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
druga wojna światowa Free English grammar and study guid hotel jelenia góra Russian bride counter strike 1.6