I am also trying the same to get the City codes which are defined in the enum "CityCodes.java" which is my enum class where I have the definition as below:
public enum Cities {
AL("Alabama","1"),
AK("Alaska","2"),
.......
WY("Wyoming","51");
---------------------------------------------------
******** My managed bean definition*************
---------------------------------------------------
public class CityCodes {
public Cities[] getCityCodes(){
return Cities.values();
}
I have the same defined in config.faces.xml
<managed-bean>
<managed-bean-name>cityCodes</managed-bean-name>
<managed-bean-class>com.web.form.CityCodes</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
While calling the same in my UI I have the code as below
<h:outputText value="#{msg.stateName}" />
<p:selectOneMenu value="#{addressForm.stateCode}">
<f:selectItems itemLabel="#{cityCodes.getCityCodes}" />
</p:selectOneMenu>
When I run the build and deploy the app....I don't get any error also I don't get the dropdown populated with the State Codes.