I have left panel that contains the link to different pages. The right panel is the one that should be updated with the new page based on the link clicked in the left panel. I want it to be an ajax update so that the left panel, header and footer do not refresh. I tried with ui:include but the page only gets refreshed on the second click. The reference to that thread is
ui:include in richfaces 4 only gets updated on second click
Is there any alternative way to achieve the same in JSF2 and Primefaces 2.2.1. Thanks
Updates
<ui:define name="content">
<h:form id="form_01">
<div style="margin:0; padding:0; float:right; width:740px;background:#FFF; ">
<p:outputPanel id="pagePanel">
<ui:include src="#{panelMenu.currentPage}.xhtml"></ui:include>
</p:outputPanel>
</div>
<div style="padding:0; float:left;">
<p:panel style="width:205px;" header="User Menu">
<h:panelGrid columns="1">
<p:commandLink update="pagePanel" action="#{panelMenu.setCurrentPage('/pages/group_message')}">
<h:outputText value="Compose"/>
</p:commandLink>
<p:separator/>
<p:commandLink update="pagePanel" action="#{panelMenu.setCurrentPage('/pages/group_detail')}">
<h:outputText value="Groups"/>
</p:commandLink>
<p:separator/>
</h:panelGrid>
</p:panel>
</div>
</h:form>
</ui:define>
Backing Bean
@ManagedBean(name="panelMenu")
@SessionScoped
public class PanelMenu {
private String currentPage = "/pages/group_detail";
public String getCurrentPage() {
System.out.println(Thread.currentThread().getStackTrace()[1]);
System.out.println(FacesContext.getCurrentInstance().getCurrentPhaseId());
return currentPage;
}
public void setCurrentPage(String currentPage) {
System.out.println(Thread.currentThread().getStackTrace()[1]);
System.out.println(FacesContext.getCurrentInstance().getCurrentPhaseId());
this.currentPage = currentPage;
}
}