0

In my application I am using ViewScoped Bean and it does not show selected row when a row is selected in primefaces datatable. But if I changed the Bean to a SessionScoped Bean then it shows the selected row perfectly.

I read some forum posts and I found that using ViewaccessScoped bean will solve the issue. Can someone help me in this issue? My jsf version is 2.2.

kolossus
  • 20,559
  • 3
  • 52
  • 104
gsk
  • 95
  • 4
  • 9
  • Which package did you import the view scope annotation from? There are two and the right one to use depends on who's managing the bean, JSF or CDI. – BalusC Sep 28 '13 at 11:47
  • I used ViewAccessedScoped Bean in place of ViewScoped and getting following errors,org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ViewAccessScoped – gsk Sep 28 '13 at 11:51
  • @BalusC I am using import javax.faces.view.ViewScoped; when using ViewScoped.and When I used import javax.faces.bean.ViewScoped; results in null pointer exception and at least doesn't show primefaces datatable. – gsk Sep 28 '13 at 11:53
  • That's thus the one from CDI. And who's managing the bean? JSF (via `@ManagedBean`) or CDI (via `@Named`)? By the way, the `@ViewAccessScoped` from CODI has already a JSF 2.2 equivalent, the `@FlowScoped`, so installing CODI for that wasn't been necessary. Just try to fix the problem instead of looking for workarounds. – BalusC Sep 28 '13 at 11:55
  • @BalusC i am using JSF managedbean – gsk Sep 28 '13 at 11:58
  • Then you should be using the `javax.faces.bean.ViewScoped` annotation from JSF and fix that NPE. What exactly is `null` and causing the NPE? – BalusC Sep 28 '13 at 12:06
  • @BalusC In my program I am putting selected row in to a cartesian chart and it is causing this NPE. java.lang.NullPointerException at org.primefaces.component.chart.CartesianChart.getCategories(CartesianChart.java:32) – gsk Sep 28 '13 at 12:14
  • @BalusC I tried removing that cartesian loading part and then also datatable returns no values without exceptions. – gsk Sep 28 '13 at 12:17
  • @BalusC I must say sorry , Beacuse I am using annotation @Named(value = "xxx"). So I must basically use javax.faces.view.ViewScoped, I will try to identify the error. – gsk Sep 28 '13 at 13:20
  • @BalusC I still could not solve. I moved my question to [this link](http://stackoverflow.com/questions/19068101/primefaces-datatable-row-selection-does-not-work-in-viewscope) please help. – gsk Sep 28 '13 at 14:43

0 Answers0