RichFaces comes with a drop down menu component. If you need to create the menu items dynamically and try using a4j:repeat, that will not work.

...
It doesn’t work because rich:dropDownMenu expects rich:menuItem as its children and thus just ignores a4j:repeat. The solution is to use c:forEach instead. When using c:forEach, the loop will be executed during compile time and all the rich:menuItems will be present in the JSF component tree.
...
The managed bean looks like this:
public class DropDownMenuBean {
private String [] menu = new String[]{"New", "Open File...", "Save", "Save As...", "Save All", "Exit"};
public String[] getItems() {
return menu;
}
public DropDownMenuBean() {}
}
One last thing, for JSTL namespace use this:
xmlns:c="http://java.sun.com/jstl/core"
Leave a reply to jethro Cancel reply