0

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?

Community
  • 1
  • 1
gkinu
  • 81
  • 2
  • 10
  • You remove `` line. Code will works when you add re-rendering. **Not related**: you can use `rendered` attribute of `rich:panelMenuItem` and achieve the same result (bean for managing pages not needed). – Vasil Lukach Jan 13 '16 at 19:44
  • Thanks. But I had also used render in rich:panelMenuItem, but it still did not work – gkinu Jan 14 '16 at 07:24

0 Answers0