On later requests, the value for such persistent fields is reloaded from storage.
The value for each field is the strategy used to store the field between requests.
The session strategy stores field changes into the session; the session is created as necessary.
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.
The flash strategy stores information in the session as well, just for not very long. Values are stored into the session, but then deleted from the session as they are first used to restore a page's state.
The flash is typically used to store temporary messages that should only be displayed to the user once.
The field is persisted onto the client; you will see an additional query parameter in each URL (or an extra hidden field in each form).
Client persistence is somewhat expensive. It can bloat the size of the rendered pages by adding hundreds of characters to each link. There is extra processing on each request to de-serialize the values encoded into the query parameter.
Client persistence does not scale very well; as more information is stored into the query parameter, its length can become problematic. In many cases, web browsers, firewalls or other servers may silently truncate the URL which will break the application.
Use client persistence with care, and store a minimal amount of data. Try to store the identity (that is, primary key) of an object, rather than the object itself.
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-30936-2.html
婚房也是现成的