1
'포함 된 페이지 1로 이동'(page2.xhtml)을 클릭하면 centerPanel (index.xhtml)이 비어 있고 doNav 메소드가 다음과 같이 호출되지 않습니다.ui : 구성 요소 내부에서 primefaces 패널 업데이트
index.xhtml
<p:layout fullPage="true">
<p:layoutUnit position="west" size="245">
<h:form>
<p:menu>
<p:submenu label="Resources">
<p:menuitem value="Page 1" actionListener="#{navBean.doNav}" update=":centerPanel">
<f:param name="page" value="page1" />
</p:menuitem>
<p:menuitem value="Page 2" actionListener="#{navBean.doNav}" update=":centerPanel">
<f:param name="page" value="page2" />
</p:menuitem>
</p:submenu>
</p:menu>
</h:form>
</p:layoutUnit>
<p:layoutUnit position="center">
<p:panel id="centerPanel">
<c:if test="#{navBean.page != null}">
<ui:include src="#{navBean.page}.xhtml" />
</c:if>
</p:panel>
</p:layoutUnit>
</p:layout>
page1.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
Page 1
</ui:composition>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://xmlns.jcp.org/jsf/core">
page2.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<h3>Page 2</h3>
<p:commandButton value="Go to page 1 from included" actionListener="#{navBean.doNav}" update=":centerPanel">
<f:param name="page" value="page1" />
</p:commandButton>
</ui:composition>
NavBean
@ManagedBean(name = "navBean")
public class NavBean {
private String page = null;
public void doNav() {
this.page = FacesContext.getCurrentInstance().getExternalContext()
.getRequestParameterMap().get("page");
}
public String getPage() {
return page;
}
public void setPage(String page) {
this.page = page;
}
}
내가이 작업을 수행 할 수 있습니다 어쨌든 있나요?
오 잘, 감사합니다! –