The difficulty I see with what you want to do is you need to find some way to call a method when the page is loaded, but not call that method when the load is a result of hitting the search button. One (probably convoluted) possibility is to set a persistent flash boolean variable that is only set when onSubmitFromSearch is called. If the variable is true, it keeps the other method from wiping out the previous search. If not, the page load starts with a blank search. That would give you what you want while maintaining the search term in the session using the persistent variable. Still it seems pretty convoluted.
You'd probably be better off to put the search terms into a url parameter or even an activation context. So basically the page would look at the URL to see if there is anything it needs to remember to search for. If not, the page would be blank. Checkout @PageActivationContext and the onActivate/onPassivate methods as ael suggested. Mark On Thu, Oct 28, 2010 at 7:42 PM, sigenz <sig...@yahoo.co.nz> wrote: > > Hi All, > > I have an T5 application like this: > http://www.crazymcphee.net/x/2009/08/26/tapestry-5-web-framework/ > > public class Persons { > > @Property > @Persist > private List persons; > @Property > @Persist > private String searchTerm; > Object onSubmitFromSearch() { > persons = personService.findPersons(searchTerm); > return this; > } > } > > I want to return the same page with the search data when the search > form is submitted, so a persistent property for the persons List is needed. > My problem is: when the page has some search results for persons, it > doesn't > disapear when the page is reloaded. I have tried to change the persistent > strategy to @Persist ("flash"), but it brings another problem: when the > search results are big and need to be displayed on multiple pages, when the > next page is clicked, the resultd disapear. > > > I need to manually clear the search data when the page is refreshed > (instead > of submitted), but not sure what method to use in the page navigation > cycle. > > Please help. > > Thanks > > Sige > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/Persistent-data-issue-tp3241417p3241417.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >