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

h:commandButton not working with JSF bean, while page is loading

Problem:h:commandButton ajax not working with JSF bean, while page is loading. A have JSF page with long list (takes couple seconds to load):
Palladium
  • 280
  • 2
  • 15
1
vote
0 answers

Spurious PreDestroyViewMapEvent with includeViewParams="true" on h:link

I have 2 views (a.xhtml and b.xhtml) one of which contains a link to the other. The first view: uses the current view map by setting some value to it; points to b.xhtml with h:link using includeViewParams="true" in order to automatically include…
Pavel S.
  • 1,202
  • 1
  • 13
  • 29
1
vote
0 answers

@ViewScoped JSF managed bean reconstructed on postbacks

I'm using JSF 2 (Mojarra 2.2.11) with WildFly9.0.1. I have 3 selectOneMenus as seen below. The ajax events work fine loading data to the next one using omnifaces converter. Problem: even if the third "Header" selectOneMenu is populated, on…
LEK
  • 83
  • 2
  • 11
1
vote
0 answers

Passing parameters: JSF page (form) -> ViewScoped backing bean -> JSP page (confirmation)

I have a JSF page with a form. When the form is submitted, a backing bean is called. The backing bean creates the entity object, saves it in the database, sends notifications, etc. and then redirects to a confirmation page that shows some data of…
karmapolice
  • 326
  • 2
  • 11
1
vote
2 answers

Xpages-Setting Up the ViewScope from client-side javaScript (oncontextmenu)

I have a Xpages in which I have repeat control, Now I have the list of documents from a view. Onclick on the row is setting the viewScope Array with the Unid. I have done this actually for the purpose of selecting the document and to keep track that…
Ajit Hogade
  • 1,072
  • 9
  • 29
1
vote
1 answer

JSF Validation fails for no (obvious) reason

I have a couple of mandatory PrimeFaces 5.2 components in my JSF 2.2 page tied to a @ViewScoped bean. The page consists of the following mandatory elements: Employee (p:autoComplete) Order (p:autoComplete) Location…
Sebastian Lang
  • 492
  • 1
  • 6
  • 18
1
vote
1 answer

@ViewScoped @ManagedBean destroyed when using

I'm using Mojarra 2.2.12. I have a case where a @ViewScoped @ManagedBean is immediately destroyed on page load, although the view is not ended. The problem is reproducible with solely the below in :
jpl
  • 347
  • 3
  • 11
1
vote
0 answers

Allow back button support for Viewscoped beans in JSF2

In my application i have multiple viewscoped beans when someone click back button in the browser it gives error for obvious reasons,my bean is destroyed when i move away from the page. I want to allow user to go back to previous page. Cache is…
1
vote
1 answer

@PostConstruct method of @ViewScoped bean is called two times on page refresh

I have a bean called indexBean and it has an init method. My bean is set to be ViewScoped. @PostConstruct public void init(){ ... System.out.println("entered"); ... } Why the init() method is called twice when I refresh the page?
rLyLmZ
  • 495
  • 4
  • 21
1
vote
0 answers

WELD-001303 No active contexts for scope type org.omnifaces.cdi.ViewScoped in GlassFish 3.1.2.2

I have a Multi-Maven-Project with some EJBs and one WAR (in one EAR). I need at least one bean to be @Named and @ViewScoped. With all beans @SessionScoped, everything works fine. If I change one bean to @org.omnifaces.cdi.ViewScoped, I get the…
Flexi
  • 41
  • 7
1
vote
1 answer

Spring with JSF 2 view scope losing injected values

I have implemented the custom view scope for spring. The page was a redirect from another bean with prerenderView listener that loads a p:datatable. The datatable is loaded with the values and then there is a p:command button to submit the data to a…
Justin Cox
  • 326
  • 4
  • 22
1
vote
1 answer

Is there a way to use @Asynchronous methods in a @ManagedBean @ViewScoped?

I have a ManagedBean Class that will have load method, this load method would then call 2 @Asynchronous methods inside that class. @ManagedBean @ViewScoped public class Loader implements Serializable { private static final long serialVersionUID =…
Mark DL
  • 45
  • 9
1
vote
1 answer

Dates with the same name in different backing beans

I am having problems using Dates with the same name in different backing beans: Backing bean 1: import java.io.Serializable; import java.util.Date; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import…
John Alexander Betts
  • 4,718
  • 8
  • 47
  • 72
1
vote
2 answers

JSF 2.2 @ViewScoped (Mojarra) Weld 2.2.3 @Produces map for SelectItems throws java.lang.String cannot be cast to java.lang.Integer

I have two producer based methods that produce maps used in a column of a h:dataTable. This is the simple page:
Gary
  • 37
  • 1
  • 9
1
vote
0 answers

ViewScoped ManagedBean is keeping alive after non-ajax post

I'm using Primefaces 4.0, Spring, Spring Security and Hibernate. I do not know why after making a post in an ajax="false" commandbutton the ViewScoped bean is returning to the form all the old values ​​and not being destroyed. In other ViewScoped…
Uyak
  • 27
  • 8