ActionLink does record the selected celebrity's ID into the link that it produces, but
that ID doesn't go further than the event handler method where it is used to retrieve
an appropriate celebrity. That celebrity is assigned to a persistent property of the
Details page and so, it is destined to be lost when the session is invalidated.
It is not a good idea to have an exception every time a user tries to bookmark a page
to see it later. To prevent this, we could use the onActivate method to check if the
celebrity property is null, and if it is, to redirect to some other page, but this is not
an elegant solution. It is not user friendly either. There is a way to both display the
Details page, and to make it bookmarkable. Have you already guessed that we can
use page activation context?
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:
t:context="celebrity.id">
${celebrity.lastName}
Remove or comment out the onShowDetails event handler method, it is not needed
either.
Pages:
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145