Wiki Markup |
---|
{float:right|background=#eee}
{contentbylabel:title=Related Articles|showLabels=false|showSpace=false|space=@self|labels=persistence}
{float} |
Persistent Page Data
Info |
---|
The use of the term "persistence" here refers to page-level persistence, NOT database persistence. |
Most instance variables in Tapestry are automatically cleared at the end of each request. This is important, as it pertains to how Tapestry pages are shared, over time, by many users.
Wiki Markup |
---|
{float:right|background=#eee}
{contentbylabel:title=Related Articles|showLabels=false|showSpace=false|space=@self|labels=persistence}
{float} |
However, you often want to store some data on a single page, and have access to it in later requests to that same page, without having to store it in a database between requests. (To store values across multiple pages, see Session Storage.)
...
The value for each field is the strategy used to store the field between requests.
Session Strategy
Wiki Markup |
---|
{float:right|background=#eee|padding=0 1em}
*JumpStart Demo:*
[Storing Data in a Page|http://jumpstart.doublenegative.com.au/jumpstart/examples/state/storingdatainapage]
[Passing Data Between Pages|http://jumpstart.doublenegative.com.au/jumpstart/examples/state/passingdatabetweenpages]
{float} |
The session strategy stores field changes into the session; the session is created as necessary. Session strategy is the default strategy used unless otherwise overridden.
A suitably long session attribute name is used; it incorporates the name of the page, the nested component id, and the name of the field.Session strategy is the default strategy used unless otherwise overridden.
Code Block | ||
---|---|---|
| ||
@Persist private int value; |
...