嗨,我有一个 p:manubar
<p:menubar model="#{topMenu.model}"/>
我想在动作事件上调用动作监听器并存储活动选项卡。我怎么能那样做?这是我的模型豆
@ManagedBean(name = "topMenu")
@RequestScoped
public class TopMenuBean {
public MenuModel model;
private UIViewRoot viewRoot;
private final MenuHelper menuHelper = new MenuHelper();
@PostConstruct
public void initModel() {
model = new DefaultMenuModel();
viewRoot = FacesContext.getCurrentInstance().getViewRoot();
String viewId = viewRoot.getViewId();
model.addMenuItem(menuHelper.itemMenuCreator(viewId, null, "Dashboard", "/pages/list.xhtml"));
model.addMenuItem(menuHelper.itemMenuCreator(viewId, null, "Configuration", "/pages/config.xhtml"));
}
public MenuModel getModel() {
return model;
}
}
有没有人有一些想法如何实现这个?