Time for action – creating the Breadcrumb menu programmatically
We can create dynamic Breadcrumb menus by creating a MenuModel object programmatically and binding the <p:breadcrumb>
component's model
attribute to the MenuModel instance as follows:
<p:breadCrumb model="#{menuController.breadcrumbMenuModel}"/>
- Create the MenuModel component and add menuitems:
public MenuController() { breadcrumbMenuModel = new DefaultMenuModel(); MenuItem item1 = new MenuItem(); item1.setValue("PrimeFaces"); item1.setUrl("http://www.primefaces.org/"); breadcrumbMenuModel.addMenuItem(item1); MenuItem item2 = new MenuItem(); item2.setValue("Board index"); item2.setUrl("http://forum.primefaces.org/index.php"); breadcrumbMenuModel.addMenuItem(item2); MenuItem item3 = new MenuItem(); item3.setValue("JavaServer Faces"); item3.setUrl("http://forum.primefaces.org/viewforum...