0 Replies - 2641 Views - Last Post: 28 August 2012 - 05:50 AM

#1 Deltale  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 02-July 12

Problem with primefaces (NullPointerException)

Posted 28 August 2012 - 05:50 AM

Hi everyone!
Here's the problem.
I want to use primefaces, on server (using Glassfish 3.x) code, seems to be ok, but after running, i get this NPE error.
And cant figure out, where its coming from..

my Bean:

package mybean;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import org.primefaces.model.chart.PieChartModel;


@ManagedBean(name = "chartBean")
@RequestScoped

public class ChartBean {
   
    private PieChartModel model;
    
    public ChartBean() {
        model = new PieChartModel();
        model.set("Brand 1", 540);
        model.set("Brand 2", 325);
        model.set("Brand 3", 702);
        model.set("Brand 4", 421);
        }
    
    public PieChartModel getModel() {
        return model;
    }
}



And index page:

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui">

	<h:head></h:head>
<f:view>
  <h:form>
    <h:outputText value="Hello My blog!!" />
    <h:inputText value="#{helloMyBlog.webFramework}" />
    <p:editor />
    <p:calendar navigator="true" pages="4"/>
    <p:pieChart value="#{chartBean.model}" />
   </h:form>
</f:view>
</html>


What can cause NPE? (Note, whole page cant be rendered because of this)

Thank you.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1