2010-12-15 73 views
0

我想動態地填充下拉菜單,所以我用<c:forEach>,但我無法看到前端的數據。如何使用c:foreach動態創建rich:dropDownMenu?

我的JSF

<rich:dropDownMenu id="drop_down" value="Add" 
      direction="bottom-right" jointPoint="auto"> 
      <c:forEach var="item" items="#{library.addLeftPanel}" > 
       <rich:menuItem submitMode="ajax" value="#{item}" 
        actionListener="#{library.populateCBConditions}" 
        reRender="tree_comp, filtab" /> 
      </c:forEach> 

</rich:dropDownMenu> 

我的Managed Bean的

private List<String> addLeftPanel; 


    /** 
* @param addLeftPanel 
*   the addLeftPanel to set 
*/ 
public void setAddLeftPanel(List<String> addLeftPanel) { 
    this.addLeftPanel = addLeftPanel; 
} 

/** 
* @return the addLeftPanel 
*/ 
public List<String> getAddLeftPanel() { 
    if(null==addLeftPanel){ 
      addLeftPanel = new ArrayList<String>(); 
    addLeftPanel.add("First"); 
    addLeftPanel.add("Secound"); 
    } 
    return addLeftPanel; 
} 

我使用JSF 1.1。

回答

2
+0

我創建了一個正常代碼,就像在與上述相同的代碼,我試圖打印放的,但是沒有得到打印的文本。對於是否有任何JSTL版本的限制。其實我只是從上面提供的鏈接開始的。 – Hariharbalaji 2010-12-21 07:59:11

+0

JSTL使用什麼命名空間?你使用JSP還是Facelets? – 2010-12-27 04:11:02

+0

另外,請確保您使用最新的JSTL Jar版本。 – 2010-12-27 20:36:06