Dynamic menu in JSF

I am trying to implement a dynamic menu with JSF2/RichFaces. The idea is simple, the menu is defined in the database, and depends on the connected user.

The menu is correctly generated, but the action is not working, and I don’t understand why. This is my JSF code:

<c:forEach items="${sessionMenu.menus}" var="menu"><!-- Menus -->
        <a target="_blank" rel="nofollow" href="#" id="${menu.label}">${menu.label}</a>
        <ul class="sub-menu" id="sub-${menu.label}">
            <c:forEach items="${menu.submenus}" var="submenu"><!-- Sub menus -->
                    <a4j:commandLink value="${submenu.label}" action="${sessionMenu.action}"/>

${sessionMenu.action} returns a string which should redirect to another page (defined as a navigation-case in the faces-config file). I also tried to replace the action with a hard-coded string, and it works, I guess that the problem arrives with the EL which is not correctly interpreted.

If some one can help me to understand what is wrong?

Edit: Here is an example of the links generated:

<a id="mainForm:j_id_g_0_2_0_2" onclick="RichFaces.ajax("mainForm:j_id_g_0_2_0_2",event,{"incId":"1"} );return false;" name="mainForm:j_id_g_0_2_0_2" target="_blank" rel="nofollow" href="#">Screen</a>

This one was generated dynamically and it does nothing;

<a id="mainForm:j_id_g_0_2_0_4" onclick="RichFaces.ajax("mainForm:j_id_g_0_2_0_4",event,{"incId":"1"} );return false;" name="mainForm:j_id_g_0_2_0_4" target="_blank" rel="nofollow" href="#">Screen</a>

And this one used a static string and the redirection is working properly.

These 2 links were generated in the same page and on the same request.

disable dynamic context menu using javascript in jsf

Is it possible to disable a dynamic context menu in JSF2.1 using java script ? document.getElementById(myForm:contextMenuId:contextMenuItemId).style.display = ‘none’; This works for a p:menuItem wr

Best practice for JSF 2 dynamic Menu handling?

i am looking for a best practice handling a simple menu with JSF and CDI. I would like to have a top menu with dynamic entries. Something like (from the main template): <ul> <c:forEach var=

JSF/AJAX Dynamic Menu – 404 issue

I am trying to make a dynamic menu such that when something is selected in the first selector, the second one is populated from the database based on the selection in the first one. Here is the .xhtml

How to create dynamic menu using database and JSF

I want to create dynamic menu from Database it’s mean i have Catagory is main menu and some catagory such as Books, CDs, Managzine . . . and Sub- Category is child of Category ( 2 table one is Categor

Icon for Primefaces Dynamic Menu

How to get an icon from JSF resources folder to a dynamic menu created from org.primefaces.model.MenuModel; The setIcon methods of menu take only a string as a parameter.

JSF dynamic navigation

I have some problem with JSF dynamic navigation. I’m using JSF 2.2 version. I’m trying to organize dynamic navigation <h:commandButton value=Enter action=loginController.result> LoginContro

Dynamic Binding in jsf

I am having an issue with Dynamic Binding in JSF page I am using JSF 1.1 All I want is manager to have the Manager Name Dynamic <%String manger=ManagerName;%> The above code is just an Snippe

Create dynamic ENUM Menu Tag in JSF 1.2

I’m struggling on this problem because it destroys my modularity a bit. I’m using JSF 1.2 and facing to use an h:selectOneMenu to select one value of a given set of Enums. e.g. public enum State { A,B

jsf facelet horizontal menu

i’m trying to do an horizontal menu, using JSF, Trinidad and facelets, the menu is created so: <f:facet name=navigation2> <tr:navigationTree inlineStyle=display: inline-block; background:

JSF select menu problem

I am developing a jsf,richfaces application.where i want to populate the values of second select menu on the basis of selecting the choice from the first one .How i can achieve this. <h:outputTe


Finally, I got it working, I just changed the action value to the method name as it is defined in my bean, that means:

<a4j:commandLink value="#{submenu.label}" action="#{sessionMenu.getAction()}" />

If some one can explain why, I am curious.