Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 不工作的柱状图面_Jsf_Jsf 2_Primefaces - Fatal编程技术网

Jsf 不工作的柱状图面

Jsf 不工作的柱状图面,jsf,jsf-2,primefaces,Jsf,Jsf 2,Primefaces,我试图用Primefaces实现一个条形图(在Pom.xml中,我有Primefaces 4.0的依赖项),但是当运行应用程序时,屏幕上不会显示任何内容,但是选择inspect元素会出现和一个脚本,仅此而已 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//ES" "http://www.w3.org/TR/xhtml

我试图用Primefaces实现一个条形图(在Pom.xml中,我有Primefaces 4.0的依赖项),但是当运行应用程序时,屏幕上不会显示任何内容,但是选择inspect元素会出现
和一个脚本,仅此而已

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//ES"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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.org/ui" lang="es">
<f:view contentType="text/html">
    <h:head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
        <meta HTTP-EQUIV="refresh" content="1803"/>
        <title>Sistema de Seguimientos de Ciclos de Calidad</title>
        <meta name="description" content=""/>
        <meta name="viewport" content="width=device-width, initial-scale=1"/>
        <link href="/sistema.ciclos.calidad/resources/css/estilo.css" media="screen" rel="stylesheet" type="text/css" />

    </h:head>
    <h:body link="#000033">
            <div id="frame" >
                 <h:form>
                    <p:barChart id="stacked" value="#{grafico.categoryModel}" legendPosition="ne" style="height:300px"
                                title="Stacked Bar Chart" stacked="true" barMargin="50" min="0" max="300"/>
                 </h:form>
            </div>

    </h:body>
</f:view>
</html>

在从3.5切换到4之后,我也遇到了同样的问题

我记得,问题是与PrimeFaces4中使用的jquery版本相关的javascript错误 我已将primefaces 4 jar中的jquery.js文件替换为primefaces 3.5 jar中的文件 &这就解决了问题

jquery.js文件在primefaces jar中的位置是


META-INF\resources\primefaces\jquery

我刚刚遇到了同样的问题

我发现问题的根源不一定是jquery的版本。似乎
本身并不包含所需的jquery脚本

在我将
添加到页面后,图表再次显示,即使它只是没有呈现(

当分别比较有和没有虚拟
的渲染结果时,我注意到
强制将以下内容包括在
中:



因此,我假设这是
中的一个bug,它只是遗漏了包含项。

不确定,但是,尝试放置
,很抱歉,如果我添加了
,但我仍然没有工作。你的primeface版本是?Iin the Pom.xml中我有Primefaces 4.0的依赖项嘿,伙计,你救了我的命!谢谢
import org.primefaces.model.chart.CartesianChartModel;
import org.primefaces.model.chart.ChartSeries;


import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import java.io.Serializable;


@ManagedBean(name = "grafico")
@ViewScoped
public class Chart implements Serializable {

    private CartesianChartModel categoryModel;

    @PostConstruct
    public void init(){
        categoryModel = new CartesianChartModel();

        ChartSeries boys = new ChartSeries();
        boys.setLabel("Boys");

        boys.set("2004", 120);
        boys.set("2005", 100);
        boys.set("2006", 44);
        boys.set("2007", 150);
        boys.set("2008", 25);

        ChartSeries girls = new ChartSeries();
        girls.setLabel("Girls");

        girls.set("2004", 52);
        girls.set("2005", 60);
        girls.set("2006", 110);
        girls.set("2007", 135);
        girls.set("2008", 120);

        categoryModel.addSeries(boys);
        categoryModel.addSeries(girls);
    }

    public CartesianChartModel getCategoryModel() {
        return categoryModel;
    }

    public void setCategoryModel(CartesianChartModel categoryModel) {
        this.categoryModel = categoryModel;
    }

}
<link type="text/css" rel="stylesheet" href="/banking/faces/javax.faces.resource/primefaces.css?ln=primefaces&amp;v=4.0" />
<script type="text/javascript" src="/banking/faces/javax.faces.resource/jquery/jquery-plugins.js?ln=primefaces&amp;v=4.0"></script>