Chris R
Chris R

Reputation: 98

Persisting Tapestry Zone

I have a zone in tapestry that displays results of a search query in a grid. When a search item is clicked you are redirected to that page. What I would like to do is be able to hit the back button and still have that search query there. Is SessionStorage the best option? If so how would you persist a tapestry zone/grid as such?

Upvotes: 1

Views: 73

Answers (1)

Dmitry Gusev
Dmitry Gusev

Reputation: 891

Instead of persisting results (zone/grid, which I'm not sure is even possible) you better persist the input: search parameters.

Using session storage is the best option in terms of simplicity, but has its own drawbacks, i.e. search results page is not bookmarkable. Not to mention that over-use of mutable server state may lead to other issues: UX (work with two browsers tabs), performance (if you have large user base and/or clustered deployment), etc.

I'd try to serialise search parameters in URL as query string. If you need to support browser back button -- use javascript history API.

Upvotes: 2

Related Questions