仪表图不显示
我遵循了 meterGaugeChart 示例,但它没有在 JSP 中显示。
当我在浏览器中查看源代码时,我发现
<p:meterGaugeChart value="org.primefaces.model.chart.MeterGaugeChartModel@1818f80"></p:meterGaugeChart>
我正在使用 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>
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
首先,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
。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 thejstl-1.0.3.jar
altogether (and make sure that you don't have astandard.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
.