webtier@glassfish.java.net

Re: JSF Issue

From: <forums_at_java.net>
Date: Thu, 22 Sep 2011 04:02:23 -0500 (CDT)

 

Hello Patrick, you will have a backing bean annotated with either
@ManagedBean or @Named, and this will have a scope. I would guess that you
are using @SessionScoped, and what you are seeing is data shared by two
browser windows that are part of the same session.   To avoid this use
@RequestScoped. Or, if you're using ajax functionality either explicitly with
f:ajax or implicitly because you're using an ajax enabled component library
like richfaces, icefaces, then you'd be better using @ViewScoped.   If your
bean is annotated with @Named then you're using CDI, and this provides the
conversation scope @ConversationScoped which supports the concept of
maintaining state on a per browser window basis. I've never really figured
out conversation scope, you can start and end conversations and you have to
think about when to perform these actions and I've never gelled with this.  
Although a more advanced topic the scopes specified by the JSF specification
are inadequate for any serious application use, but happily you can download
MyFaces CODI which provides the very useful @ViewAccessScoped scope (you
don't have to be using MyFaces JSF to use this).

--
[Message sent by forum member 'oversteer']
View Post: http://forums.java.net/node/840129