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