You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Blake Nicholson <ta...@package.com> on 2003/06/11 22:15:59 UTC

persistent page property question

I have a page MyPage that contains a form with several fields that are used 
to conduct a search.  The bottom half of the page displays an HTML table 
with the results of the search.  Each item in the list of results is 
surrounded by an ActionLink which will invoke a method to perform some 
action on the selected object.

Since I need the search results both to display the list to the user as 
well as to resolve which object was clicked on, I have made my 
searchResults property persistent.  Making searchResults a persistent page 
property causes the "search and select" to work as I would like (no 
StaleLink error), but is a problem when the user eventually comes back to 
MyPage later in their session.  searchResults is pre-populated with the 
results of the previous query when the user enters the page.  To work 
around this, I always do the following when displaying MyPage:

MyPage nextPage = (MyPage) cycle.getPage("MyPage");
nextPage.setSearchResults(null);
cycle.setPage(nextPage)

Is this the appropriate way to accomplish my goal?  Is there some other 
"Tapestry approved" way that would be better than my approach?

What about the case where I have a component MyComponent with the search 
form and results display, rather than a page?  My searchResults property 
still needs to be persistent, but I'm unclear on how I should clear out 
searchResults so that results from MyComponent on one page do not show up 
in MyComponent on another page.  What is the proper way to reset a 
persistent property that has scope across several request cycles, but not 
across the user's entire session?


Thanks!
Blake