Feather problems do not work with ui: repeat

I cannot perform palette management. I dynamically create crackers using ui: repeat. The moment I wrapped it in the p: breadCrumb tag , I cannot see the control on the page

The following code I use in my .xhtml

<p:breadCrumb> <ui:repeat value="#{conversationScope.trail}" var="bcrumb"> <h:outputLink value="#{bcrumb.url}"> <h:outputText value="#{bcrumb.label}" /> <h:outputText value=">" /> </h:outputLink> <p:menuitem value="#{bcrumb.label}" url="#{bcrumb.url}" /> </ui:repeat> </p:breadCrumb> 

Please suggest an alternative?

+3
primefaces
source share
1 answer

To create the <p:breadCrumb> menu in PrimeFaces dynamically, you will want to use the MenuModel object in the bean for the breadCrumb component for rendering. Scroll through the list of trails by creating MenuItems and add a MenuModel to them.

In your .xhtml

 <p:breadCrumb model="#{crumbBean.model}" /> 

Bean to add menu items to the palette menu.

 import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; import org.primefaces.component.menuitem.MenuItem; import org.primefaces.model.DefaultMenuModel; import org.primefaces.model.MenuModel; @ManagedBean @RequestScoped public class CrumbBean { private MenuModel model; public CrumbBean() { model = new DefaultMenuModel(); MenuItem item1 = new MenuItem(); item1.setValue("First"); item1.setUrl("#"); model.addMenuItem(item1); MenuItem item2 = new MenuItem(); item2.setValue("Second"); item2.setUrl("#"); model.addMenuItem(item2); } public MenuModel getModel() { return model; } } 
+5
source share

All Articles