Tim Holloway wrote:Welcome to the JavaRanch, Khalid!
We're having a special on that question this week.
I'll give the same response as I have to everyone else: Why not simply use a dataTable?
I would like to use ui:repeat within a <h:selectOneMenu> tag
Ah. Today is my day to be completely and stupidly blind. Speaking of going blind, there's a "Code" button on our message editor. You can use it to wrap java code, xml and other things that the normal text editor won't display well.
I don't think you're going to be able to use ui:repeat there.
A JSF page is not a program like a normal JSP is. It's a declaration. So trying to do program-like things on a JSF view often fails, as can be seen by all the people who are asking questions like yours.
Beyond that, the JSF tags have very specifically-defined interrelationships. You can't validly insert a textInput control within a textOutput control for example.
For a DataTable, you need a DataModel to serve as the UI sub-model in the JSF Model/View/Controller setup. In most cases your table itself will be an array or List of elements of some sort of class, with the properties of the class serving as column names. In your case, for example:
You could then create a List of ColorItems, wrap them with a ListDataModel object and return that object to the dataTable in the View as the dataTable's "value" attribute.
All this is awkward, if not impossible to do in a JSF view. But then, that's what Backing Beans are for.