【发布时间】:2016-10-27 10:31:50
【问题描述】:
我将 Primefaces 5.3 与 bootsfaces 一起用于我的 Web 层。我遇到的问题是我在使用组件 poll 的 facelet 中收到错误“Primefaces is not defined”,如下所示:
<b:row id="results">
<c:if test="${not empty twitterSearch.text or not empty twitterSearch.result }">
<b:panel title="Tweets for #{twitterSearch.text}" collapsible="false" look="info" col-md="6">
<h:form>
<p:poll interval="3" update="sentimentChart" />
<p:chart id="sentimentChart" type="pie" model="#{liveSentimentChartBean.liveCharts.get(twitterSearch.text)}" style="width:400px;height:300px"/>
</h:form>
</b:panel>
</c:if>
</b:row>
这个名为 analysis.xhtml 的 facelet 是 app_template.xhtml 模板的 facelet 客户端,因此它的根元素如下:
<ui:composition xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:b="http://bootsfaces.net/ui"
template="/WEB-INF/templates/app_template.xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui">
我知道问题通常是由于 facelet 中缺少 h:head 标签,但这是在模板中定义的,如下所示:
<?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:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:b="http://bootsfaces.net/ui"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
<h:head>
<meta charset="utf-8" />
<title>#{i18n['page.title']}</title>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="revisit-after" content="7 days" />
<meta name="DISTRIBUTION" content="GLOBAL" />
<meta http-equiv="PRAGMA" content="NO-CACHE" />
</h:head>
<h:body>
<c:set var="root" value="#{request.contextPath}/" />
<ui:insert name="navbar">
<ui:include src="/WEB-INF/content/navbar.xhtml"/>
</ui:insert>
<b:container>
<ui:insert name="content" />
</b:container>
<ui:insert name="footer">
<ui:remove>
<ui:include src="/WEB-INF/content/footer.xhtml"/>
</ui:remove>
</ui:insert>
</h:body>
</html>
有谁知道问题可能是由于?在此先感谢:)
【问题讨论】:
-
如果您在模板中添加(虚拟)
p:outputText或p:inpuText是否有效? -
我用 p: panel 试过了
标签: jsf primefaces jsf-2