Questions tagged [view-scope]

The View Scope means that you can keep the object alive as long as you are staying on the view (page).

The @ViewScoped has been introduced by JSF 2.0 specification. In a nutshell the data which is @ViewScoped will keep living as long as you don't navigate to another page to itself. The view scope is very convenient, since it allows the pattern of initializing data when you first access a page (via a non-faces request, which is typically a GET request) and then keep that data when you work on the page, doing post-backs, AJAX requests, etc.

258 questions
2
votes
1 answer

Multiple browser tabs or windows with the same ViewScoped bean class

Using Payara Server 4.1.2.174 with mojarra 2.2.15. I have a simple Named Bean with scope javax.faces.view.ViewScoped. import java.io.Serializable; import java.util.logging.Level; import java.util.logging.Logger; import…
2
votes
3 answers

How to create a view scoped bean in JSF 1.x?

I have 2 links in a web page, link one pint to appserver/?dept=1, link two is appserver/?dept=2. Then I have a JSF phase listener, in there, I can get the back end bean and set dept1 or dept2 as the bean parameter, in order to render different…
Charles
  • 161
  • 1
  • 3
  • 12
2
votes
0 answers

Two ViewScoped CDI beans, one injected into the other, and one JSF page: Instances differ

I have two ViewScoped CDI beans A and B and one JSF page. One bean (B) is injected into the other (A). Both are accessed directly from the JSF page. After some debugging I found that the instance of B injected into A is not the same as the instance…
user1785730
  • 3,150
  • 4
  • 27
  • 50
2
votes
1 answer

Why is this ViewScoped managed bean not working and how can I make it work?

This is the list page I have: First Name #{actor.firstname}
Koray Tugay
  • 22,894
  • 45
  • 188
  • 319
2
votes
1 answer

Removing @ViewScoped beans in a SPA JSF 2.2 application

We are using an SPA approach in our JSF 2.2 + PrimeFaces enabled application. The basic idea was originally described very well here: Refreshing dynamic content with AJAX in JSF using SPA approach But, as we know, using this SPA approach has a…
Maikel Nait
  • 251
  • 3
  • 18
2
votes
0 answers

@ViewScoped managed bean gets destroyed when using h:inputFile

I have problems using h:inputFile to upload Files in JSF 2.2.7 and Glassfish 4.1. I'm trying to get h:inputFile to work, but whenever I use the uploaded Part object from h:inputFile, the Backing bean gets destroyed and created again. Also the setter…
user3135185
  • 913
  • 1
  • 7
  • 13
2
votes
0 answers

How to use View Scope in Spring

Dears, I try to use View Scope in Spring and I get the following steps as straightforward: 1- create the View Scope as following: package scope; import java.util.Map; import javax.faces.context.FacesContext; import…
Hazim
  • 805
  • 11
  • 24
2
votes
0 answers

Data of backing bean in View Scope shared across multiple users

One of my JSF backing bean is in View Scope (since there is data table which requires pagination). The problem is that, when two users access this backing bean at the same time, the results in data table are getting overlapped.
crazyProgrammer
  • 65
  • 1
  • 2
  • 7
2
votes
1 answer

Xpages falling out of server side cache

This issue may have to do with a very specific Domino version (see below), so I start with a few technical details: Server in question is a virtualized Windows 2008 R2 64bit machine. Domino release is IBM Domino (r) Server (64 Bit) (Release…
Lothar Mueller
  • 2,528
  • 1
  • 16
  • 29
2
votes
1 answer

@PostConstruct in @ViewScoped bean invoked on every request

I'm using JSF2.2 and PrimeFaces 5.2 and I have a list of chackboxes which posts a request via Every time a post happens the @PostConstruct method of the been…
simonC
  • 4,101
  • 10
  • 50
  • 78
2
votes
1 answer

All @ViewScoped annotations (JSF, CDI, OmniFaces) act like @RequestScoped

I'm using: Wildfly 8.2, JSF 2.2 (Mojarra 2.2.8) , Omnifaces 2.1 and java 7. The problem is that I've created some objects and every request they are recreated (null). I also tried using conversationScope but the same thing happens. Using…
Victor Bello
  • 493
  • 1
  • 8
  • 23
2
votes
1 answer

JSF Memory leak: bean not destroyed on refresh / redirect on same page

I use JSF viewscope for my managedbean. I call the managed bean in a html view. When the page is refresh, there is a new managed bean allowed and the old one stay in the memory. If I refresh and refresh and refresh... I have got a huge number of…
user3805731
  • 275
  • 2
  • 3
  • 13
2
votes
1 answer

View scope: java.io.NotSerializableException: javax.faces.component.html.HtmlInputText

There is an error each time a button calls an action from the backing-bean. Only applies to beans with a view scope and I haven't found a way to fix it without regression over other modules in the code. DefaultFacele E Exiting serializeView -…
Kollaps
  • 21
  • 1
  • 3
2
votes
1 answer

Share data between JSF @ViewScoped and WebSocket @ServerEndpoint

I'm using JSR356 web sockets and want to add some functions and values to my Server End Point class instead of creating another ManagedBean. Also i'd like to keep bean properties between requests, so i annotated my Server End Point with annotation…
user3127896
  • 6,323
  • 15
  • 39
  • 65
2
votes
0 answers

How to destroy ViewScope context with JSF 2.2.6?

Each time, I go on a specific jsf page which bean is annotated with @ViewScoped, the heap increase. How to destroy ViewScope context ? (to destroy all associated objects and clean memory heap) Upgrading to 2.2.8 give me other errors, so i want to…
ZheFrench
  • 1,164
  • 3
  • 22
  • 46