myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <craig...@apache.org>
Subject Re: Restore View question
Date Thu, 22 Dec 2005 18:22:39 GMT
On 12/22/05, Matthias Kahlau <mkahlau@web.de> wrote:
>
> 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?


The lifetime of the backing bean controls how long such a component instance
would be preserved.  However, for this use case, I would recommend binding
the *value* of the component to a session bean property, rather than the
component itself.  JSF will take care of the rest of the component state for
you.

Regards,
>
> Matthias


Craig

Mime
View raw message