Hariharbalaji
Hariharbalaji

Reputation: 2578

how to create rich:dropDownMenu dynamically using c:foreach?

I wanted to populate a dropdowm menu dynamically, so i used <c:forEach> but i'm not able see the data in the frontend.

My 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>

My 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;
}

I'm using JSF 1.1 .

Upvotes: 0

Views: 2610

Answers (1)

Related Questions