Hi

In JSF 2.2 it was decided to store view scope beans always in session
(take a look at the description of @ViewScoped annotation in the
javadoc). But you can just call facesContext.getViewRoot() and use the
attribute map. Just remember the values there must be Serializable or
implement StateHolder.

In my understanding, this was done in this way to support @PreDestroy
annotation when the session is expired.

regards,

Leonardo Uribe



2014-02-12 23:28 GMT-05:00 user 01 <user...@gmail.com>:
> I'm using Myfaces 2.2 with Client-side state saving. I see that the
> ViewScoped beans & data stored in viewmap is lost after the user session is
> destroyed.
> I came to know, not sure if it is correct, that this is the expected
> behavior but then what's the way to avoid view expired exceptions after
> session destroy?
>
> My problem is that I destroy the user session pretty quickly after some
> inactivity period(like after 20 minutes) but I want the viewscope data to
> survive even after that(when using client saving) so that when the user
> comes back after session destroy, he doesn't need to do a page refresh. I
> dont know why & how this is so implemented but It is very normal that the
> user may be busy reading some section of website or be away for 20 minutes,
> & as he comes back & interacts with opened pages, how would I make that
> work without the state ?
> I think this is a common requirement for any public websites.
>
> I think the internally used jsf viewstate is not lost, if I use client side
> state saving(as my pages still work), but then why are those viewscoped
> beans scoped that were also serialized to page along with the viewstate.
>
> If this the designed behavior, Is there any way I could make the view
> scoped data survive session expiration ?

Reply via email to