本文介绍了如何使面条面条痕迹动态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用原文,并且想添加一个面包屑菜单。
如何动态加载导航痕迹?
您有什么建议或经验?
code><号码:面包屑>
< p:menuitem value =Categoriesurl =#/>
< p:menuitem value =Sportsurl =#/>
< p:menuitem value =Basketballurl =#/>
< p:menuitem value =NBAurl =#/>
< p:menuitem value =Teamsurl =#/>
< p:menuitem value =L.A。湖人url =#/>
< p:menuitem value =Rosterurl =#/>
< p:menuitem value =Kobe Bryanturl =#/>
< / p:breadCrumb>
解决方案
BreadCrumb作为模型
属性。这一个用于从原始文档(Mainplace Documentation)中的MenuBar动态创建menuitem(您已经不用了,为了适应BreadCrumb):
public class MenuBean {
private MenuModel model;
public MenuBean(){
model = new DefaultMenuModel();
//第一个子菜单
DefaultSubMenu firstSubmenu = new DefaultSubMenu(Dynamic Submenu);
DefaultMenuItem item = new DefaultMenuItem(External);
item.setUrl(http://www.primefaces.org);
item.setIcon(ui-icon-home);
firstSubmenu.addElement(item);
model.addElement(firstSubmenu);
//第二个子菜单
DefaultSubMenu secondSubmenu = new DefaultSubMenu(Dynamic Actions);
item = new DefaultMenuItem(Save);
item.setIcon(ui-icon-disk);
item.setCommand(#{menuBean.save});
item.setUpdate(messages);
secondSubmenu.addElement(item);
item = new DefaultMenuItem(Delete);
item.setIcon(ui-icon-close);
item.setCommand(#{menuBean.delete});
item.setAjax(false);
secondSubmenu.addElement(item);
item = new DefaultMenuItem(Redirect);
item.setIcon(ui-icon-search);
item.setCommand(#{menuBean.redirect});
secondSubmenu.addElement(item);
model.addElement(secondSubmenu);
}
public MenuModel getModel(){
return model;
}
}
此后,您只需像这样调用模型在你的面包屑里面:
model =#{menuBean.model}
/ pre>
I'm using primefaces and want to add a breadcrumb menu. How should I load my breadcrumb dynamically? What advise or experience do you have?
<p:breadCrumb> <p:menuitem value="Categories" url="#" /> <p:menuitem value="Sports" url="#" /> <p:menuitem value="Basketball" url="#" /> <p:menuitem value="NBA" url="#" /> <p:menuitem value="Teams" url="#" /> <p:menuitem value="L.A. Lakers" url="#" /> <p:menuitem value="Roster" url="#" /> <p:menuitem value="Kobe Bryant" url="#" /> </p:breadCrumb>
解决方案BreadCrumb as a
model
in attribute. This one serve to create menuitem dynamically like this example for MenuBar from Primefaces Documentation (You have off course, to adapt this one for BreadCrumb):public class MenuBean { private MenuModel model; public MenuBean() { model = new DefaultMenuModel(); // First submenu DefaultSubMenu firstSubmenu = new DefaultSubMenu("Dynamic Submenu"); DefaultMenuItem item = new DefaultMenuItem("External"); item.setUrl("http://www.primefaces.org"); item.setIcon("ui-icon-home"); firstSubmenu.addElement(item); model.addElement(firstSubmenu); // Second submenu DefaultSubMenu secondSubmenu = new DefaultSubMenu("Dynamic Actions"); item = new DefaultMenuItem("Save"); item.setIcon("ui-icon-disk"); item.setCommand("#{menuBean.save}"); item.setUpdate("messages"); secondSubmenu.addElement(item); item = new DefaultMenuItem("Delete"); item.setIcon("ui-icon-close"); item.setCommand("#{menuBean.delete}"); item.setAjax(false); secondSubmenu.addElement(item); item = new DefaultMenuItem("Redirect"); item.setIcon("ui-icon-search"); item.setCommand("#{menuBean.redirect}"); secondSubmenu.addElement(item); model.addElement(secondSubmenu); } public MenuModel getModel() { return model; } }
After this you have just to call the model like this inside your breadcrumb :
model="#{menuBean.model}"
这篇关于如何使面条面条痕迹动态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!