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

Injected Session Scoped Bean in View Scoped bean duplicating

I have a ViewScoped bean and in this bean I am injecting a SessionScoped bean. A lot of information is found on this and is pretty straight forward. Session bean import java.io.Serializable; import java.util.ArrayList; import…
blo0p3r
  • 6,790
  • 8
  • 49
  • 68
2
votes
1 answer

Serialization of ManagedProperty

We have the following problem with JSF's @ViewScoped and @ManagedProperty: we have ManagedBeans that basically look as follows: @ManagedBean @SessionScope public class SessionConfig implements Serializable { //…
Matz
  • 86
  • 1
  • 5
1
vote
1 answer

@ViewScoped bean behaves like @SessionScoped or @ApplicationScoped

I have a Spring Boot application using JSF/CDI. Backing beans are annotated with @Named @ViewScoped, but while browsing between other pages values still stay on textboxes. Values should've been cleared. In other words, the backing beans unexpectedly…
1
vote
0 answers

Manually process `unload` event before triggering `preDestroy` method in OmniFaces ViewScoped bean

As a follow up to my question @PreDestroy method not called when leaving page of bean annotated with OmniFaces "ViewScoped" I have one other question: Is it possible to process the JavaScript unload event manually before the @PreDestroy annotated…
scholt
  • 180
  • 4
  • 19
1
vote
1 answer

JSF 2.3: Session expired vs ViewExpired problems

I am using JSF 2.3 (Mojarra), with PrimeFaces 7 on WildFly 17 and have a problem with (I suppose) an expired http ession, which I was not able to answer using the links below: keep getting javax.faces.application.ViewExpiredException: viewId with…
Alex Mi
  • 1,409
  • 2
  • 21
  • 35
1
vote
0 answers

Omnifaces ViewScoped with PWAResourceHandler

I have a web application currently deployed on Wildfly 23.0.2, using JSF 2.3 and OpenJDK 11. I'm also using the latest version of OmniFaces (3.11). One of the application requirements is PWA support. For this, I'm using PWAResourceHandler exactly as…
areal
  • 157
  • 5
1
vote
1 answer

Xpages viewScope to sort a repeat control column

I am trying to click a link and sort a view by a column in a repeat using viewScope with a full SSJS refresh (also tried partial refresh on the the repeat control, on the table within, and on the panel surrounding the whole thing). When I click it,…
m benway
  • 245
  • 2
  • 10
1
vote
0 answers

JSF @ViewScoped behaves as @ApplicationScoped

@ManagedBean is deprecated so I used recommended CDI replacement @Named with its javax.faces.view.ViewScoped annotation (not the JSF javax.faces.bean.ViewScoped one). PROBLEM Bean behaves as @ApplicationScoped that is @PostConstruct is being…
matoni
  • 2,479
  • 21
  • 39
1
vote
1 answer

ViewScoped bean on multiple browser tabs conflicts

I'm using JSF Mojarra 2.3.8 with Tomcat 8 (with additional libraries required for CDI and JPA). I have a ViewScoped bean: @Named @ViewScoped public class MyBean implements Serializable { ... I have a page that uses this bean. I open the page in 2…
Edward
  • 580
  • 3
  • 15
1
vote
1 answer

@org.omnifaces.cdi.ViewScoped invokes @PostConstruct on unload of an already destroyed view

I have a problem working with @org.omnifaces.cdi.ViewScoped and multiple tabs: I have a link in TestPage.xhtml that opens another page (ShowValuePage.xhtml) with a request parameter "someValue". If I open this link 10 times in a new tab and navigate…
heiwil
  • 612
  • 4
  • 8
1
vote
0 answers

@javax.faces.view.ViewScoped call @PostConstruct on p:commandButton action from p:datatable column facet

I have a primefaces datatable where the commandButton's action addItem within the columns header facet always fires the CDI @ViewScoped beans @PostConstruct method, while the commandButton's action editItem from the column does not?! Curiously…
raho
  • 129
  • 4
  • 18
1
vote
0 answers

PrimeFaces datatable with dynamic columns of any column content using newer Mojarra 2.1 versions

We are running on Java EE 6 + PrimeFaces 3.5.28 + JSF 2.1.6 (currently) on GlassFish 3.1.2.2. Our requirement for the datatables is to have dynamic columns, which can basically be of any content, that is simple output text, complex output texts,…
Kawu
  • 13,647
  • 34
  • 123
  • 195
1
vote
2 answers

loading scope value into an array doesnt work in angularjs

Please consider the small angularJs code snippet below. $scope.myArray = []; function sampleMethod(){ $scope.myArray.push({ name: $scope.name, age: $scope.age }); console.log($scope.myArray.name); }; Here, I was trying…
das
  • 669
  • 2
  • 12
  • 22
1
vote
0 answers

ViewScoped bean is recreated each ajax request using p:remoteCommand

I have a javascript function responsible to call 2 managed bean methods using the problem is that in one method i have to generate a value and use it in the second method, but when I call to the second method the value is null and…
1
vote
1 answer

How do I count the number of views in a user's JSF session (JSF 2.2)?

I'm trying to track view usage (coming up against the default 15-count limit) but not quite sure where to get this information. Is it available in FacesContext somewhere? Using JSF 2.2, ICEfaces 3.3, and Omnifaces 2.2.
wsaxton
  • 1,030
  • 15
  • 34