tapestry4的页面属性persistent

来源:互联网 发布:网络卫星电视直播软件 编辑:程序博客网 时间:2024/05/17 09:29

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 and app. If you omit the scope it will default to client: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.

 
原创粉丝点击