Hi!

Many thanks. Yes, I confused the term "page" with "site" in the late night.

> von Simon Kitching
> Gesendet: Donnerstag, 22. Dezember 2005 02:58
> 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.


I experienced an additional case where component-binding causes a different
behavior than without when a page is revisited after another page. I added
component-binding (using a session backing-bean) to my components because
the page with the component-binding components is left by the user to an
edit details page, and might be revisited after the user presses the cancel
or save button on the second page. When the user then revisits the first
page, the values of the components had to be retained, because they are not
saved in the model when the user leaves the page to edit the details (I
didn't want any validation to occur, that's why the validation phase/update
model phase is skipped).

With component-binding (and session backing-bean), it was possible that the
component values of the first page are retained (e. g. the text the user
entered in an inputText). So the component-binding components of the
component tree of the first view/page seem not to be discarded when the
component tree of the second view is created.

So, my question is: when are component-binding components, or at least,
their properties discarded? Does it only depend on the lifetime of the
related backing-bean or any explicit modifications of the components?


Regards,

Matthias

> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Auftrag
> von Simon Kitching
> Gesendet: Donnerstag, 22. Dezember 2005 02:58
> An: MyFaces Discussion
> Betreff: Re: Restore View question
>
>
> 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