1
我使用Primefaces 3.0.1并用编程式填充模型构建了一个菜单栏。我需要一些链接,如depotDetails.xhtml? ID = 1但是,如果使用这些URL我的菜单项如何正确添加SetPropertyActionListener?
item.setUrl("depotDetail.xhtml?id=1"); // that dont work
,所以我尝试添加一个ActionListener:
FacesContext facesContext = FacesContext.getCurrentInstance();
ValueExpression target = facesContext.getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{DepotBean.currentDepot}",String.class);
ValueExpression value = facesContext.getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "ehnemeneee",String.class);
ActionListener handler = new SetPropertyActionListenerImpl(target, value);
item.addActionListener(handler);
但也不要工作。任何人都可以帮忙吗?
Greets Thomas
你是什么意思item.setUrl(“depotDetail.xhtml?id = 1”); //不工作?网址没有被调用,或者它不包含任何网址或不完整的网址? – 2012-01-28 07:38:25
你试过item.setUrl(“depotDetail.jsf?id = 1”); ? – Daniel 2012-01-28 08:57:30
是的,我尝试过,但它只通过depotDetail.xhtml不带参数 – thomas 2012-01-28 11:23:39