0

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"...

  • What happens if you change the order of panel groups? – Jasper de Vries Oct 12 '16 at 07:26
  • Is `.menuAccessible` idempotent, that is, dois it always return the same result no matter how many times it's called? For debugging, try inserting something like `` before `menuItem1`, in order to test that. – Haroldo_OK Oct 13 '16 at 14:21
  • This snipet of code it's working, please try to share more of xhtml code. – bilelovitch Oct 13 '16 at 14:27
  • Well, found out it is something related to MyBean. Guess what, when I put a Thread.sleep(20) in the method getCurrentUser() of the bean, then all panels are displayed. What could explain this sort of behavior? – Alexandre Gazola Oct 13 '16 at 17:29

0 Answers0