I'm currently working on modularizing an existing project. I use the following hirarchy:
Module Group
-Module
To navigate between the modules, I use a MenuBar. As one may guess: The module groups are Submenus, the modules are MenuItems.
To keep everything dynamic, I build a MenuModel from the module groups and modules. Which modules/groups to include in the MenuBar should be configurable. That's why I want to create it dynamically.
However, I encountered a problem: How can I navigate to the View of the selected module(which is represented by a MenuItem)? I'm currently use a custom MethodExpression that redirects me to the desired URL via
Code: Select all
FacesContext.getCurrentInstance().getExternalContext().redirect(module.getURL());
I can't use an ActionListener, since I need to pass the URL to the ActionListener which is not possible (Since JSF wants to create its own ActionListener and therefore needs a default constructor).
Is there a proper way to navigate to my module while using a dynamic MenuModel?