Dynamic Primefaces与ui的动态对话框:包括PF从4.0升级到5.1后不工作
我最近将Primefaces从4.0升级到了5.1,之后单击commandButton后,对话框将不会显示。它与dynamic=“false”一起工作,但我需要将其延迟加载。ExampleBean是SessionScope,我使用的是JSF2.2。有人能帮我解决这个问题吗Dynamic Primefaces与ui的动态对话框:包括PF从4.0升级到5.1后不工作,dynamic,jsf-2,primefaces,modal-dialog,uiinclude,Dynamic,Jsf 2,Primefaces,Modal Dialog,Uiinclude,我最近将Primefaces从4.0升级到了5.1,之后单击commandButton后,对话框将不会显示。它与dynamic=“false”一起工作,但我需要将其延迟加载。ExampleBean是SessionScope,我使用的是JSF2.2。有人能帮我解决这个问题吗 <ui:composition template="/template/common/pagelayout.xhtml" xmlns="http://www.w3.org/1999/xhtml" xmln
<ui:composition template="/template/common/pagelayout.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:ez="http://xmlns.jcp.org/jsf/composite">
<ui:define name="content">
<h:form id="form">
<p:commandButton type="button" value="Log" onclick="PF('dlgLog').show();" icon="botaoLog" />
</h:form>
<p:dialog header="HEADER" widgetVar="dlgLog" resizable="false" modal="true" height="500" width="1000" dynamic="true">
<ui:include src="logPage.xhtml"/>
</p:dialog>
</ui:define>
</ui:composition>
logPage.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h:form id="formlog">
<p:dataTable var="log" value="#{exampleBean.logs}" emptyMessage="Empty">
<p:column headerText="Header1" width="10%">
<h:outputText value="#{log.date}">
<f:convertDateTime pattern="dd/MM/yyyy - HH:mm"/>
</h:outputText>
</p:column>
<p:column headerText="Header2" width="10%">
<h:outputText value="#{log.op}" />
</p:column>
<p:column headerText="Header3">
<p:outputLabel value="#{log.name}"/>
</p:column>
</p:dataTable>
</h:form>
</h:body>
</html>
终于找到了问题所在。刚刚从logPage.xhtml中删除了
标记,它就成功了!虽然我不知道原因,但可能与
期望的合成不应该有
标记有关。更具体地说,您删除了h:head标记()。在您使用的版本之间,PF创建了自己的h:head呈现程序,它不同于代码jsf库中的默认实现,因此在行为上存在差异(假设您的jsf impl保持不变) 我想你应该做到ui:composition:Thank@JaqenH'ghar。试图让它成为ui:composition,但没有成功。我可以通过hibernate在控制台中生成的sql看到,page logPage.xhtml中的内容是从db加载的,但对话框仍然没有显示;相关:再次感谢@Kukeltje!不知道primefaces的h:head渲染器!我去看看。