JSF is not showing component even though the attribute "rendered" evaluates to true

152 views Asked by At

I have a simple JSF page with several tags like this:

  ...
  <h:form>
  ...
  <h:panelGroup id="menuItem1" styleClass="topLevelMenu" layout="block"
        rendered="#{MyBean.currentUser.menuAccessible}">
            <h:outputText value="Menu 1"/>
    </h:panelGroup>

  <h:panelGroup id="menuItem2" styleClass="topLevelMenu" layout="block"
        rendered="#{MyBean.currentUser.menuAccessible}">
            <h:outputText value="Menu 2"/>
    </h:panelGroup>

  <h:panelGroup id="menuItem3" styleClass="topLevelMenu" layout="block"
        rendered="#{MyBean.currentUser.menuAccessible}">
            <h:outputText value="Menu 3"/>
    </h:panelGroup>
  ...
  </h:form>
  ...

The rendered condition is "true" (I've verified it with the debugger). What seems strange is that only the second and the third items (Menu 2 and Menu 3) are displayed. The first one, even though it has the same condition for "rendered" as the other two, is not displayed! When I change the first one to rendered="true" then it displays normally.

Any ideas why this could be happening? I have around 15 panelGroups arranged like these in my page (I'm using them to create the menu items for the application).

Note: I'm migrating the application from JSF 1.2 to JSF 2.1. I just made this change t:div (which was correctly working previously) to h:panelGroup layout="block"...

0

There are 0 answers