我使用的是Primefaces 5.1。当我按下按钮动态包括页面,但它不工作。我尝试下面的代码:
page.xhtml
<f:subview id="userView">
<h:form id="userId">
<p:commandButton id="userButton" value="Import"
action="user.pageAction" update=":userView:dynamicPanel"/>
</h:form>
<p:panel id="dynamicPanel">
<ui:include src="${BranchDetails.PagePath}" />
</p:panel>
</f:subview>
pageClass.java
public void pageAction()
{
pagePath="/pages/userMangement/userDetail.xhtml"
}
我尝试更新facescontext和请求上下文也,但它不包括页面.getRenderIds .getPartialViewContext FacesContext.getCurrentInstance()()()阀门(":dynamicPanel "); RequestContext.getCurrentInstance () .update(":dynamicPanel")我尝试替换(:dynamicPanel到dynamicPanel)更新,但也不工作。
动作用错了
<f:subview id="userView">
<h:form id="userId">
<p:commandButton id="userButton" value="Import"
action="user.pageAction" update=":userView:dynamicPanel"/>
</h:form>
<p:panel id="dynamicPanel">
<ui:include src="${BranchDetails.PagePath}" />
</p:panel>
</f:subview>
正确<f:subview id="userView">
<h:form id="userId">
<p:commandButton id="userButton" value="Import"
action="#{user.pageAction}" update=":dynamicPanel"/>
</h:form>
<p:panel id="dynamicPanel">
<ui:include src="${BranchDetails.PagePath}" />
</p:panel>
</f:subview>