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
2 answers

Is it bad to use JSF #view.attributes map instead of #viewScope to store view scoped application data?

I was suggested by someone to use #view.attributes map to store view scoped data that I need to survive even after session destroys(with client side state saving). Now that it works perfect for my requirement but I just want to make sure this is…
Rajat Gupta
  • 25,853
  • 63
  • 179
  • 294
2
votes
1 answer

How to pass bean property from one view to another view

I'm using JSF 2.1 and Primefaces: I have a view scoped managed bean with a managed property and a method that set something on other view scoped managed bean and forward to other page referencing that managed bean: @ManagedBean @ViewScoped public…
andolffer.joseph
  • 613
  • 2
  • 10
  • 24
2
votes
1 answer

Open a link in new tab/window without loosing the view scope of current JSF page

I need to open a new JSF page (say 2.xhtml) in new tab from current JSF page (say 1.xhtml). Which JSF component should I use for it? or ? I do not want to lose the scope of current page 1.xhtml after clicking on the…
Shivagoy
  • 373
  • 3
  • 5
  • 15
2
votes
2 answers

JSF logout with ViewScoped bean

In my application I have a top bar with a logout button that call the bean method public String logout(){ FacesContext.getCurrentInstance().getExternalContext().invalidateSession(); return Navigator.goTo("/index.xhtml"); } it works well,…
Cattani Simone
  • 1,168
  • 4
  • 12
  • 30
2
votes
2 answers

jsf variable lost value

I have a managed Bean called bean1.java that has a boolean var called found. The variable says if a client has been found or not. The bean has a method validate() that goes to the DB and checks if the client exists, and sets the variable to …
2
votes
1 answer

p:fileUpload calls bean constructor for each file

I'm trying to use to upload a file. Here's the view:
Niko
  • 1,054
  • 5
  • 25
  • 52
2
votes
1 answer

ContextNotActiveException when OmniFaces ViewScoped bean is injected in servlet

I've just updated a SessionScoped bean to OmniFaces (1.6.1) ViewScoped. Everything seems to work except for the fact that I get the following Exception when my backing bean is injected into a Servlet that I'm using for the processing of an ajax…
Greg H
  • 445
  • 4
  • 12
2
votes
2 answers

How to disable loading screen of DeltaSpike

How can I disable the loading screen which appears when using @ViewScoped with DeltaSpike?
Thomas
  • 8,357
  • 15
  • 45
  • 81
2
votes
1 answer

WELD-001303 No active contexts for scope type javax.faces.view.ViewScoped

I have switched to javax.enterprise.context.SessionScoped to javax.faces.view.ViewScoped Upgraded faces 2.1 to 2.2 to be able to use ViewScoped with my CDI injections. After I switched to ViewScoped I have started getting this error and I can't…
Pinchy
  • 1,506
  • 8
  • 28
  • 49
2
votes
1 answer

CDI ViewScope Using CDI Extension or MyFaces CODI or SeamFaces

I see everybody using MyFaces CODI or SeamFaces ViewScope Services saying that CDI don't have @ViewScope annotation If the ViewScope serve just to retrieve the bean after each ajax call back, I think CDI provides extension to add your own…
Kurohige
  • 333
  • 2
  • 10
2
votes
3 answers

Managed Bean with properties Inherited from a superclass

I had problems when building a JSF project with ViewScope ManagedBeans. So I decided to isolate the problem to a simple code where obviously the problem persists. Basically I realized that the properties that are in the class TesteMBean work…
2
votes
2 answers

Property action listener is not called when attached to Primefaces' command link

I am using Primefaces and I have a problem that the setPropertyActionListener isn't fired and thus isn't setting a property of a view scoped managed bean. My view:
simonTifo
  • 307
  • 3
  • 12
  • 29
2
votes
1 answer

JSF View Scoped Bean Reconstructed Multiple Times

I thought @ViewScoped was supposed to prevent the bean from being reconstructed while the user is on the same page... So why is my @ViewScoped JSf controller bean being created multiple times even before the action handler causes the browser to…
Ryan Bennetts
  • 1,143
  • 2
  • 16
  • 29
2
votes
0 answers

JSF 2 DataTable with multiple headers on dynamic columns

I'm developing a data-centric Web Application using JSF 2.1 and PrimeFaces 3.4. As a result of a specific query, I must display the results in a bi-dimensional data table with some dynamic columns (imagine a sort of Pivot-table). Currently I use a…
yankee
  • 509
  • 2
  • 9
  • 18
2
votes
1 answer

Errors while adding dynamic form field

I am trying to add dynamic form fields to jsf form. But even following simple codes gives errors. test.xhtml
nsumer
  • 301
  • 4
  • 18