I'm struggling on this problem because it destroys my modularity a bit. I'm using JSF 1.2 and facing to use an h:selectOneMenu to select one value of a given set of Enums.
e.g.
public enum State {
A,B,C;
};
For instance, i'd do sth. like this:
<h:selectOneMenu>
<f:selectItem itemValue="A" itemLabel="text" />
<f:selectItem itemValue="B" itemLabel="text" />
<f:selectItem itemValue="C" itemLabel="text" />
</h:selectOneMenu>
So i'm searching for a way (e.g. a custom tag) to get this more generic.
Regarding the view component I want to get all available choices as an independent f:selectItem in my menu.
The available choices could be passed by a list or sth. else.
The first method I tried was to use an a4j:repeat tag for my selectItems with a set of choices passed to this tag, but the only thing I got was an empty menu.
My idea was some kind of custom tag that looks like this:
<namespace:enumMenu enumValues="#{values}" value=#{value}" />
Consider a passed set of enums with values A,B,C,D it should result in sth. like
<h:selectOneMenu value=#{value}>
<!-- REPEAT for every enum Item in the passed #values -->
<f:selectItem itemValue="A" />
<f:selectItem itemValue="B" />
<f:selectItem itemValue="C" />
<f:selectItem itemValue="D" />
</h:selectOneMenu>
Every help is appreciated