Hi @ all,

does someone knows a way to bind some constants? Perhaps with help of Enums?


Here my person class with gender const.

Class Person{
    /** Constants for the gender */
    public static final int GENDER_MALE = 1;
    public static final int GENDER_FEMALE = 2;





Here my jps.
...
<tr:selectOneChoice label="Gender"  value="#{person.gender}" required="true">
 <f:selectItem itemLabel="#{text['person.genderMale']}" itemValue="1"/>
 <f:selectItem itemLabel="#{text['person.genderFemale']}" itemValue="2"/>


I want something like this!
<tr:selectOneChoice label="Gender"  value="#{person.gender}" required="true">
  <f:selectItem itemLabel="#{text['person.gender']}" 
itemValue="#{person.GENDER_MALE}"/>
  <f:selectItem itemLabel="#{text['person.gender']}" 
itemValue="#{person.GENDER_FEMALE}"/>



I thought about create a getter for each const but if I have some more it would 
be not very pretty to
Have a getter for each const value.
I also thought about enums, but I do not really how I could implement this. Has 
someone a solution for this?



Thank you.
Martin

Reply via email to