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

Re-execute f:viewAction when ViewScoped bean is recreated following a POST request

Environment: JSF 2.2 with Mojarra 2.2.12 & CDI ViewScoped beans & javax.faces.STATE_SAVING_METHOD set to client. In order to properly initialize my bean thanks to , I would like to (re-)execute
Mathieu Castets
  • 5,861
  • 3
  • 28
  • 37
4
votes
1 answer

How to put data in view scope via EL in JSF page

In my JSF page this works: ${requestScope.put('test', 'data')} ${requestScope.get('test')} This causes exception: ${viewScope.put('test', 'data')} ${viewScope.get('test')} Exception: java.lang.NullPointerException …
Panu Haaramo
  • 2,932
  • 19
  • 41
4
votes
1 answer

Spring 4 and JSF ViewScope

In Spring 3 and JSF 2.0 when we wanted to use the JSF view scope we had to introduce custom ViewScope implementation and instruct Spring to pick it up through CustomScopeConfigurer. Has Spring 4 made any progress in the JSF integration on this…
JanM
  • 1,385
  • 1
  • 15
  • 25
4
votes
2 answers

Restoring request parameters in @ViewScoped bean after session expires

I have a page that has the setup as below with url like my.page.com/table.xhtml?id=123: +----------------------------------------------+ |Meta information | |----------------------------------------------| | …
4
votes
1 answer

How and when is a view scope bean removed from LRU cache in JSF?

I have read an excellent answer when view scoped bean is destroyed. (see How and when is a @ViewScoped bean destroyed in JSF?) and I automatically assumed that destroyed bean is also removed from the view scope cache. But I could see that bean is…
jherkel
  • 55
  • 1
  • 5
4
votes
1 answer

How can I know if a viewScope variable has been initialized

In an application I need to know if a viewScope variable has been initialized. When the viewScope variable is created the value might be null. So viewScope.isEmpty("SomeName") does not tell me that it has been intialized and the answer is null or it…
Bill F
  • 2,057
  • 3
  • 18
  • 39
4
votes
1 answer

Is rich:fileUpload component in (RC 4.3.4) working on Apache Tomcat7 and JSF 2.2 ? : "Request prolog cannot be read"

I'm trying to upload a file with richfaces fileupload component. My bean is in a viewscoped. My code extracted from the showcase.
ZheFrench
  • 1,164
  • 3
  • 22
  • 46
3
votes
1 answer

ViewScoped bean getting constructed on every request... part 99

ARGH... This seems to have a hundred answers and I haven't found one that works for me, so I guess I will actually ask it again. Here is my scenario: My site technically has a single page whose contents get swapped out rather than having multiple…
Lucas
  • 14,227
  • 9
  • 74
  • 124
3
votes
1 answer

Button can be clicked only once on a XPage

I have the following XPage which has one table and only two tr's. The first one is a button itself which puts into viewScope['showPasswordTr'] boolean true value when clicked first time, when puts false when clicked again. The second tr has an input…
J Doe
  • 33
  • 3
3
votes
0 answers

JSF CDI ViewScoped Bean @PreDestroy throws Null Pointer Exception on Session Timeout

I have CDI ViewScoped Bean with @Named and @ViewScoped Annotation. I have @PreConstruct and @PreDestroy functions defined. When I navigate from My JSF page to another page using h:commandLink, my @PreDestroy function gets called and all my resources…
3
votes
1 answer

JSF: Mojarra vs. OmniFaces @ViewScoped: @PreDestroy called but bean can't be garbage collected

This question is specific to the OmniFaces @ViewScoped bean (however of interest to wider discussion about memory leakage and resource disposal with JSF @ViewScoped). It is based on the results of this NetBeans8.1 test web app available on…
3
votes
0 answers

How do you pass parameters and navigate to Spring managed bean with custom scope - view?

I would like to give you some context first. The Context I am currently developing a web application using Spring framework, where I would like to provide users with displaying/editing different instances of the same entity type of model in separate…
Kit Ostrihon
  • 824
  • 2
  • 14
  • 36
3
votes
1 answer

Passivation capable beans must satisfy passivation capable dependencies

I'm having a little issue with OmniFaces's Viewscoped. Even with my Managedbean implementing Serializable, I'm receiving the error below: Passivation capable beans must satisfy passivation capable dependencies. With some research, I found some…
3
votes
1 answer

CDI ViewScope & PrettyFaces: Multiple calls to @PostConstruct (JSF 2.2)

I'v already check similar questions which declare that JSF 2.1 had this bug, but I'm using JSF 2.2 Let's detail: My environment: CDI: 1.1 Dynamic Web Module: 3.0 Java: 1.7 JSF: 2.2 PrettyFaces: 2.0.12.Final My Bean: @Named(value =…
Manu Artero
  • 9,238
  • 6
  • 58
  • 73
3
votes
1 answer

@ViewScoped @PostContruct is called upon every ajax request

Using Primefaces 5.0, JSF 2.2.7, deployed on EAP 6.1. I have this Managed Bean below. import hh.bean.Service; import hh.dao.ServiceDao; import hh.dao.impl.ServiceDaoImpl; import java.io.Serializable; import java.util.List; import…
binary_assemble
  • 394
  • 3
  • 17
1 2
3
17 18