仪表图不显示

发布于 2024-12-26 01:30:59 字数 793 浏览 1 评论 0原文

我遵循了 meterGaugeChart 示例,但它没有在 JSP 中显示。

当我在浏览器中查看源代码时,我发现

<p:meterGaugeChart value="org.primefaces.model.chart.MeterGaugeChartModel@1818f80"></p:meterGaugeChart>

我正在使用 primefaces-3.0.jarjsf-api-2.0.3.jarjsf-impl- 2.0.3.jarjstl-1.0.2.jar

<h:body>
    <ui:composition template="template/commonLayout.xhtml">
        <ui:define name="content">
            <h:form>
                <p:meterGaugeChart value="#{welcome.meterGaugeModel}" /> 
            </h:form>
        </ui:define>
    </ui:composition>
</h:body>

I followed the meterGaugeChart example and it doesn't show in JSP.

When I view the source in browser I found

<p:meterGaugeChart value="org.primefaces.model.chart.MeterGaugeChartModel@1818f80"></p:meterGaugeChart>

I'm using primefaces-3.0.jar, jsf-api-2.0.3.jar, jsf-impl-2.0.3.jar, jstl-1.0.2.jar.

<h:body>
    <ui:composition template="template/commonLayout.xhtml">
        <ui:define name="content">
            <h:form>
                <p:meterGaugeChart value="#{welcome.meterGaugeModel}" /> 
            </h:form>
        </ui:define>
    </ui:composition>
</h:body>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

单身狗的梦 2025-01-02 01:30:59

首先,PrimeFaces 2.x/3.x不支持JSP。它仅适用于 Facelets。但由于您在代码示例中使用 Facelets 标记,并且您似乎没有抱怨 Facelets 标记在 HTML 源代码中也可见,因此我认为您只是将 JSP 与 Facelets 混淆了。 Facelets 基于 XHTML,是旧的和已弃用的 JSP 的继承者。如果您的文件扩展名是 .xhtml,那么您就已准备就绪。但如果它确实 .jsp,那么您需要将其重命名为.xhtml

其次,您使用的是完全过时的 JSTL 版本。您需要 JSTL 1.2,您可以下载作为 jstl-1.2.jar。完全替换 jstl-1.0.3.jar(并确保您没有 standard.jar 文件)。

最后,您需要确保已在 Facelet XHTML 文件的根标记中声明了正确的 PrimeFaces 3.0 命名空间。它应该指向http://primefaces.org/ui

<html xmlns:p="http://primefaces.org/ui">

First of all, PrimeFaces 2.x/3.x does not support JSP. It works in Facelets only. But since you are using Facelets tags in your code example and you didn't seem to complain that Facelets tags are also visible in the HTML source, I assume that you're just confusing JSP with Facelets. Facelets is XHTML based and the successor of the old and deprecated JSP. If your file extension is .xhtml, then you're all set. But if it is really .jsp, then you need to rename it to .xhtml.

Second of all, you're using there a completely outdated JSTL version. You need JSTL 1.2 which you can download as jstl-1.2.jar. Replace the jstl-1.0.3.jar altogether (and make sure that you don't have a standard.jar file).

Finally, you need to make sure that you've declared the proper PrimeFaces 3.0 namespace in the root tag of the Facelet XHTML file. It should point to http://primefaces.org/ui.

<html xmlns:p="http://primefaces.org/ui">
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文