Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用primefaces 3.5在jsf 2.0中以编程方式进行菜单项导航_Jsf_Jsf 2_Primefaces - Fatal编程技术网

如何使用primefaces 3.5在jsf 2.0中以编程方式进行菜单项导航

如何使用primefaces 3.5在jsf 2.0中以编程方式进行菜单项导航,jsf,jsf-2,primefaces,Jsf,Jsf 2,Primefaces,在这里的一个应用程序中,我们以前使用richfaces这样做: HtmlMenuItem menu = (HtmlMenuItem) context.getApplication().createComponent(HtmlMenuItem.COMPONENT_TYPE); menu.setValue(FacesUtils.bundle(item.getChavelocale())); // menu.s

在这里的一个应用程序中,我们以前使用richfaces这样做:

  HtmlMenuItem menu = (HtmlMenuItem) context.getApplication().createComponent(HtmlMenuItem.COMPONENT_TYPE);  
                    menu.setValue(FacesUtils.bundle(item.getChavelocale()));   
                  //  menu.setSubmitMode("ajax");
                    menu.getAttributes().put("myParam", item.getNavegacao());
                    MethodExpression action = context.getApplication().getExpressionFactory().createMethodExpression(context.getELContext(), item.getNavegacao(), null, new Class<?>[0]);
                    menu.setActionExpression(action);
                    menu.setImmediate(false);
                    pai.getChildren().add(menu);
HtmlMenuItem菜单=(HtmlMenuItem)context.getApplication().createComponent(HtmlMenuItem.COMPONENT_类型);
menu.setValue(FacesUtils.bundle(item.getChavelocale());
//menu.setSubmitMode(“ajax”);
menu.getAttributes().put(“myParam”,item.getNavegacao());
MethodExpression action=context.getApplication().getExpressionFactory().createMethodExpression(context.getELContext(),item.getNavegacao(),null,新类[0]);
menu.setActionExpression(动作);
menu.setImmediate(false);
pai.getChildren().add(菜单);
迁移到primefaces后,我们尝试此操作,但未执行任何操作:

  MenuItem menu = new MenuItem();  
                    menu.setValue(FacesUtils.bundle(item.getChavelocale()));   
                  //  menu.setSubmitMode("ajax");
                    menu.getAttributes().put("myParam", item.getNavegacao());
                    MethodExpression action = context.getApplication().getExpressionFactory().createMethodExpression(context.getELContext(), item.getNavegacao(), null, new Class<?>[0]);
                    menu.setActionExpression(action);
                    menu.setImmediate(true);
                    pai.getChildren().add(menu);
MenuItem menu=new MenuItem();
menu.setValue(FacesUtils.bundle(item.getChavelocale());
//menu.setSubmitMode(“ajax”);
menu.getAttributes().put(“myParam”,item.getNavegacao());
MethodExpression action=context.getApplication().getExpressionFactory().createMethodExpression(context.getELContext(),item.getNavegacao(),null,新类[0]);
menu.setActionExpression(动作);
menu.setImmediate(true);
pai.getChildren().add(菜单);

出现问题或这不是正确的方法?

尝试使用
DefaultMenuModel
DefaultSubMenu
DefaultMenuItem
对象