Matthias Kahlau wrote:
Hi!


I would like to know when a JSF site can be restored, and when the component
tree of a JSF site has to be recreated. I know that the component tree is
created when a JSF site is shown the first time. I think, a component tree
can always be restored after a postback.

But are there other possible constellations when a component tree can be
restored, e. g., is a component tree restored, when the site is shown again,
after another site has been shown?

And just to be sure, does creating the component tree mean that all
components are newly created?

A JSF component tree is created when a JSP page is visited.

When the user repeatedly views the same page, the same component tree is used. Well, actually it is a new tree but all the components in the tree have their properties reset to the same state as the previous tree, so for all practical purposes they can be treated as the same components.

However as soon as the user selects an option that takes them to a different page, the component tree for the old page is discarded. The new JSP page is rendered, causing a fresh component to be created for each JSF tag in the new page.

Even if they later revisit a page they went to earlier, a new component tree is created (because the old one has long since been discarded).

There are exceptions to this, eg when a component has a binding to a bean of session scope. And the browser back-button can cause old cached component trees to be restored. However that's the exception not the typical behaviour.

Regards,

Simon

Reply via email to