I have successfully implemented the solution given in this question -> How to ajax-refresh dynamic include content by navigation menu? (JSF SPA). However, I want to navigate using rich:panelMenu. So instead of using h:commandLink, I want to use rich:panelMenuItem. So instead of having the code below ....
<h:panelGroup id="menu" layout="block">
<h:form>
<f:ajax render=":content">
<ul>
<li><h:commandLink value="include1" action="#{bean.setPage('include1')}" /></li>
<li><h:commandLink value="include2" action="#{bean.setPage('include2')}" /></li>
<li><h:commandLink value="include3" action="#{bean.setPage('include3')}" /></li>
</ul>
</f:ajax>
</h:form>
</h:panelGroup>
<h:panelGroup id="content" layout="block">
<ui:include src="/WEB-INF/includes/#{bean.page}.xhtml" />
</h:panelGroup>
..... i want to have ....
<h:panelGroup id="menu" layout="block">
<h:form>
<rich:panelMenu>
<rich:panelMenuGroup label="Group 1">
<rich:panelMenuItem label="include1" action="#{bean.setPage('include1')}" />
<rich:panelMenuItem label="include2" action="#{bean.setPage('include2')}" />
<rich:panelMenuItem label="include3" action="#{bean.setPage('include3')}" />
</rich:panelMenuGroup>
</rich:panelMenu>
</h:form>
</h:panelGroup>
<h:panelGroup id="content" layout="block">
<ui:include src="/WEB-INF/includes/#{bean.page}.xhtml" />
</h:panelGroup>
The bean is as implemented in the example, that is ....
@ManagedBean
@ViewScoped
public class Bean implements Serializable {
private String page;
@PostConstruct
public void init() {
page = "include1"; // Default include.
}
// +getter+setter.
}
For some reasons, the rich:panelMenuItem way is not working. What could I be doing wrong?