myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From user 01 <user...@gmail.com>
Subject Re: How to survive viewscoped beans/viewmap after session destroy (using client side saving)?
Date Thu, 13 Feb 2014 20:01:06 GMT
Thanks a lot Leonardo for the solution. Played somewhat with it, looks like
it'll works for me. The data survives session destroys.

What is this attributes map otherwise really meant for, to maintain JSF
internal viewstate ? Is it safe for me to use it like that ? Looks like a
hack infact:)

I could use the attributes map to store values/ objects, can't I just use
this map to store the viewscoped beans simply?


On Thu, Feb 13, 2014 at 11:05 AM, Leonardo Uribe <lu4242@gmail.com> wrote:

> 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 <userw93@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 ?
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message