Julien Martin wrote:
Hello,
I have a basic question about JSF: I would like to know where the UIViewRoot instances are stored (for a given app with several UIViewRoots). Is it in some sort of java.util collection or in a specific class?

I'm not sure what you mean by an app having "several UIViewRoots".

When a user first visits a particular view (ie a particular page) the component tree is created (ie a UIViewRoot plus children).

If you have configured MyFaces to use "client-side state saving" then at the end of every request the current component tree is "serialized" (using a custom JSF serialization mechanism) and stored as a (very large) hidden field in the form. When the page is later submitted back to the server the component tree is recreated from the serialized data. When the user then moves on to some other view the component tree is discarded and a new one created for the new view using the appropriate technology (jsp, facelets, clay, whatever).

If "server-side state saving with serialization" is configured then at the end of each request the current component tree is serialized and stored in the http-session.

If "server-side state saving without serialization" is configured then at the end of the request a reference to the component tree is just cached in the http-session.

In addition, if server-side state saving is configured then MyFaces keeps a list of the most recent N component trees in a FIFO queue stored in the http session; this is managed by class JspStateManagerImpl. This data supports the use of the back-button. Storing old component trees is not needed when using client-side state saving (the browser effectively does this instead).

Regards,

Simon

Reply via email to