myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominico Francisco <dominico_franci...@yahoo.com>
Subject How to dynamically render XMLMenuModel menu items
Date Fri, 20 Jun 2008 19:23:46 GMT
Question on XMLMenuModel:
 
Can I hide certain menu items on a menu model based on a managed bean attribute?
 
For example, I have the menu-metadata, where Login and Register menu items should appear
only if #{UserInfoBean.authenticated} is false and MyMessages and Logout menu items should
appear only if #{UserInfoBean.authenticated} is true.
 
How can I control the rendering of the commandNavigationItem if using the XMLMenuModel?
 
XMLMenuModel and CommandNavigationItem below
 
<?xml version="1.0" encoding="iso-8859-1"?>
<menu xmlns="http://myfaces.apache.org/trinidad/menu">
    <itemNode id="in1" label="Home" action="Home"
              focusViewId="/index.jsp">
        <itemNode id="in11" label="My Messages" action="MyMessages"
                  focusViewId="/mymessages.jsp"/>
        <itemNode id="in12" label="Login" action="Login"
                  focusViewId="/login.jsp"/>
        <itemNode id="in13" label="Register"
                  action="MyContacts" focusViewId="/register.jsp"/>
        <itemNode id="in14" label="Logout" action="Logout"
                  focusViewId="/logout.jsp"/> 
   </itemNode>
 </menu>
 
  
        <f:facet name="navigation1">
          <tr:navigationPane hint="tabs" var="menu" value="#{root_menu}"
                             level="0">
            <f:facet name="nodeStamp">
              <tr:commandNavigationItem text="#{menu.label}"
                                        action="#{menu.doAction}"
                                        destination="#{menu.destination}"
                                        rendered="#{menu.rendered}"/>
            </f:facet>
 
Thanks,
DF


      
Mime
View raw message