Another possiblity is using Tomahawk's t:saveState component (or creating your own).
It makes a request-scoped bean into a page-scope-plus bean. It does this by saving the state of the target into the component tree (either using Serializable or SaveState interfaces). Whenever the tag appears on a page, the object will be restored when the page is restored and saved when the page is rendered. Thus it's ideal for page scope (add t:saveState component with a unique id) or page-plus-scope (add the component to multiple pages with the same id). If you don't want all of tomahawk, it should be easy to pull this tag out by itself since it has no renderer and no dependencies. If you're using jsp, you'd probably need to copy the tld, the jsp tag handler class, the component class, and the faces-config.xml entry. If you're using facelets, you can copy the component class, the faces-config.xml entry, and create a taglib.xml entry. http://myfaces.apache.org/tomahawk/uiSaveState.html http://wiki.apache.org/myfaces/SaveState On 4/12/07, Francisco Passos <[EMAIL PROTECTED]> wrote:
Hello there. Using just the request, I've found some solutions to keeping some state between requests. I would like these findings to be validated and if you find any incorrections, please point them out, since I'm going to rely heavily on these mechanisms for a large-hit application (several hundreds of users). Method 1 - hidden inputs ======================== One of these mechanisms is placing <h:inputHidden value="#{myBean.property}" /> in the destination page, which will seamlessly populate the new instance property with the value it had in the previous page. This requires adding one field for each value. The values are discarded in subsequent requests to other pages, unless they possess similar hidden inputs to be populated. Method 2 - pageFlowScope ======================== Another method is using the pageFlowScope explicitly (for instance, slightly modifying the getter and setter of a bean property in order to use the pageFlowScope). Albeit a scope, one cannot declare a managed bean to have that scope in faces-config, which actually is not so cool. This method requires manual retrieval and update of the variable in the pageFlowScope. And the values need to be discarded manually. However, this allows for keeping context values in parallel browsing sessions (which does not work when using session beans). Method 3 - Dialog Framework =========================== Finally, I've just discovered the dialog framework, but haven't yet tried it out. If it works the way I imagine, it is pretty seamless (except for the dialog: prefix in the actions). However, suppose a url exists in the page which invokes a get to another page. Is state persisted? Or is it discarded, because the flow doesn't go through a dialog:-prefixed action? In my opinion it should be discarded in such cases. I can easily check this soon if no-one knows the answer to this. That about covers what I've found. Did I misinterpret anything? Furthermore, did I miss something? Thanks, Francisco Passos