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
7
votes
1 answer

Spring view scope is not destroyed when session gets invalidated in websphere

I am using Springboot 1.5.9.RELEASE,JSF 2.2.20 (glassfish),Primefaces 8 running on WebSphere 8.5.5.13 , and I have defined custom view scope, based on the following link : https://github.com/jneat/spring-jsf public class ViewScope implements Scope,…
Mahmoud Saleh
  • 33,303
  • 119
  • 337
  • 498
7
votes
1 answer

@ViewScoped Managed bean loads many times during postback

I have a calendar, editor, fileUpload and a dataTable primefaces controls on a jsf facelet. Code is as follows,
Devendra
  • 71
  • 1
  • 3
7
votes
1 answer

Why are expired @ViewScoped beans not destroyed until the session expires

I'm using Mojarra 2.2.4 on GlassFish 4 with Java 7. As I understand from BalusC's answer to How and when is a @ViewScoped bean destroyed in JSF?, @ViewScoped beans should be destroyed in three cases: Post-back with non-null outcome Session…
7
votes
1 answer

Viewscoped JSF and CDI bean

I'm using Java EE 6 on JBoss EAP 6, and my JSF beans are annotated like this: @ManagedBean @ViewScoped (both from javax.faces.bean package) However, they are also CDI beans (default constructor, use of @Inject, @PreDestroy etc). I'm reading all the…
htft
  • 113
  • 1
  • 3
7
votes
3 answers

WARNING: Setting non-serializable attribute value into ViewMap, followed by java.io.NotSerializableException

I have the same application in 2 systems(laptops) but it's working in one but not in another.I get the following error in another system. I have also posted the code below. What I want to do is cascading dropdown with a button that calls a method of…
z22
  • 10,013
  • 17
  • 70
  • 126
6
votes
1 answer

JSF ViewScope - returning null on actions do not update the view

I have a Managed Bean in ViewScope mode. So, when I call some action from this Managed Bean my page do not update. I see that my action is invoked well and returning null (viewscope work flow is OK). So, what am I doing wrong? If I rerender the…
andolffer.joseph
  • 613
  • 2
  • 10
  • 24
6
votes
3 answers

Memory leak with ViewScoped bean?

In our JavaEE6 project (EJB3, JSF2) on JBoss 7.1.1, it seems we have a memory leak with SeamFaces @ViewScoped. We made a little prototype to check the fact : we use JMeter to call a page 200 times; the page contains and calls a viewscoped bean…
Xavier Portebois
  • 3,354
  • 6
  • 33
  • 53
5
votes
1 answer

JSF without @ViewScoped

I've been using JSF for many years and in the next project we're aiming to make the web-tier as stateless as possible. One possibility I'm exploring is removing @ViewScoped beans in favour of @RequestScoped (plus one or two @SessionScoped beans as…
StuPointerException
  • 7,117
  • 5
  • 29
  • 54
5
votes
1 answer

Inject CDI bean into JSF @ViewScoped bean

I have a problem with JSF, CDI project. I did a lot of research and I found that in CDI there is no @ViewedScoped annotation. I solving problem with ajax based page with dialog. I want to pass variable to dialog from datatable. For this purpose, I…
Milkmaid
  • 1,659
  • 4
  • 26
  • 39
5
votes
1 answer

How to pass objects from one page to another page in JSF without writing a converter

first of all sorry for my english. I have two pages in JSF2, one to list Passengers and another one to create/update passengers. I have also two @ViewScoped beans, one with the list of passengers and one for hold in pageB the selected passenger. I…
SaGiTaRiO
  • 63
  • 1
  • 6
5
votes
1 answer

@PostConstruct of @ViewScoped is invoked on every request

I've got problem with opening dialog in JSF 2.2.7 and Primefaces 5. I've got button which opens a dialog and the problem is everytime when I click the button @PostConstruct method is executed. Why? I want to invoke @PostConstruct only 1 time, but I…
jrola
  • 298
  • 7
  • 21
5
votes
2 answers

java.io.NotSerializableException when @ViewScoped is used

If I use @ViewScoped in JSF, then the following exception occurs: java.io.NotSerializableException: com.solv.basics.Basics java.io.ObjectOutputStream.writeObject0(Unknown Source) java.io.ObjectOutputStream.writeObject(Unknown Source) …
vijaya kumar
  • 824
  • 2
  • 12
  • 21
5
votes
1 answer

PrimeFaces p:media not working with StreamedContent in a @ViewScoped bean

I have an issue related to Primefaces4 meida type rendering pdf file in browser. I have successfully tried the example in showcase from primefaces website. Now I want to get a new feature, which offers an tree structure with document nodes in the…
Cong Wang
  • 206
  • 1
  • 3
  • 12
5
votes
2 answers

commandButton click in p:dataTable causes @ViewScoped bean to be re@Produced after application invocation

The view: The controller: @ApplicationScoped public…
Matyas
  • 13,473
  • 3
  • 60
  • 73
4
votes
1 answer

How do you find CDI beans of/in the current view (scope)?

In a Java EE 6, CDI 1.1.x, Seam 3 etc. environment, we need to find all CDI beans of the current view (@ViewScoped). What I have tried so far is using: @Named @ViewScoped public class ViewHelper { @Inject private BeanManager beanManager; …
Kawu
  • 13,647
  • 34
  • 123
  • 195
1
2
3
17 18