Tapestry defines two basic types of property persistence. The type of persistence (internally known as the property persistence strategy ) is defined by the value of the persist attribute (in the <property> element). Omitting the persist attribute, or not providing a <property> element, indicates a transient page property, one which does not persist from request to request.
-
client
-
Client properties are stored on the client, in the form of query parameters. All persistent properties for each page are encoded into a single query parameter, named
state:
PageName . (每个页面所有的持久化属性被编码到一个单独的查询参数中,名字为 state:pageName)The query parameter value is a MIME encoded byte stream. This can get quite long if there are many client persistent properties on the page ... which may quickly run into limitations on the maximum size of a URL (approximately 4000 characters is a good guideline)( 注:可能达到URL最大长度的限制). This is less a problem for forms. -
In Tapestry 4.0 the concept of a scope was introduced, specifying how long a property will persist. For
client
there exist two scopes:page
andapp
. If you omit the scope it will default toclient:page
. (默认是client:page)-
client:page
-
Persisted properties will be available until another page is activated and rendered.
client:app
-
Persisted properties will always be available.
session
-
- The traditional style of property persistence (and the only kind available in Tapestry 3.0 and earlier). Each persistent property is mapped to a HttpSession attribute.
More such stategies are expected; these will give more control over the lifecycle of the page property.