在JSF中找不到组件标识符

时间:2014-03-13 15:20:38

标签: jsf jsf-2 highcharts

我有一个文件Chart.xhtml,如下所示

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:cc="http://java.sun.com/jsf/composite"
  xmlns:h="http://java.sun.com/jsf/html" >

<cc:interface>
    <cc:attribute name="title" />
    <cc:attribute name="subTitle" />
    <cc:attribute name="yLabel" />
    <cc:attribute name="xLabel" />
    <cc:attribute name="xMinTickInterval"  />
</cc:interface>

<cc:implementation>
    <h:outputScript name="javascript/highcharts/js/highcharts.js" target="head" />

    <div id="#{cc.id}_chartDiv"/>

    <script type="text/javascript">               
        $(function() {
            // Data must be defined WITHIN the function. This prevents
            // different charts using the same data variables. 
            var options = {
                credits: {
                    enabled: false
                },
                chart: {
                     renderTo: '#{cc.id}_chartDiv',
                     zoomType: 'x',
                     width: 720
                     //margin: [50, 50, 100, 80]
                 },
                 title: {
                     text: '#{cc.attrs.title}'
                 },
                 subtitle: {
                     text: '#{cc.attrs.subTitle}'
                 },
                 xAxis: {
                     title: {
                         enabled: true,
                         text: '#{cc.attrs.xLabel}'
                     }, 
                     minTickInterval: '#{cc.attrs.xMinTickInterval}'
                 },
                 yAxis: {
                     title: {
                         text: '#{cc.attrs.yLabel}'
                     }
                 },
                 legend: {
                     enabled: false
                 }
            };
            // Don't create the chart if there are no series defined.
            if(typeof options.series !== "undefined") {
                if(options.series.length > 1) {
                    options.legend.enabled = true;
                }
                var chart = new Highcharts.Chart(options);
            }
        });
    </script>
</cc:implementation>

以上xml是从

调用的自定义标记

<hc:Chart title="New Zealand Nation Ethnic Population Estimates for 2006" xLabel="Age Groups (Years)" yLabel="Percentage of Total Population">

这是包含库声明的文件

<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<facelet-taglib version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd">

<namespace>http://nz.co.kevindoran/highcharts-jsf</namespace>
<tag>
    <tag-name>Chart</tag-name>
    <source>highcharts/Chart.xhtml</source>
</tag>
<tag>
    <tag-name>ColumnSeries</tag-name>
    <source>highcharts/ColumnSeries.xhtml</source>
</tag>
<tag>
    <tag-name>CartesianSeries</tag-name>
    <source>highcharts/CartesianSeries.xhtml</source>
</tag>
<tag>
    <tag-name>ColumnOptions</tag-name>
    <source>highcharts/ColumnOptions.xhtml</source>
</tag>
<tag>
    <tag-name>TimeChart</tag-name>
    <source>highcharts/TimeChart.xhtml</source>
</tag>
<tag>
    <tag-name>TimeSeries</tag-name>
    <source>highcharts/TimeSeries.xhtml</source>
</tag>
<tag>
    <tag-name>TimeTrendChart</tag-name>
    <source>highcharts/TimeTrendChart.xhtml</source>
</tag>
<tag>
    <tag-name>Tooltip</tag-name>
    <source>highcharts/Tooltip.xhtml</source>
</tag>
<composite-library-name>highcharts</composite-library-name>

错误看起来像 /WEB-INF/highcharts/Chart.xhtml @7,19 <cc:interface> Component Not Found for identifier: j_idt8.getParent().

为什么会这样?

1 个答案:

答案 0 :(得分:0)

您的实体类'Char'是否具有属性'parent'?

看起来你的实体确实有一个属性'Parent',但你没有在“cc:interface”标签中引用它。

尝试在“cc:interface”标记内添加以下内容:

cc:attribute name =“parent”

相关问题