I use this simple approach, it is quite optimistic, you can customize it for your own purpose. I put the following code in a reusable bean, that can be called from your application at any time, so you can use any of your enums declared in your package.
public List fromEnum(String cname) {
List names = new ArrayList<>();
try {
Class c = Class.forName(cname);
Object[] r = c.getEnumConstants();
if (r != null) {
for (Object o : r) {
names.add(o.toString());
}
}
} catch (ClassNotFoundException ex) {
FaceUtil.ShowError(ex);
}
return names;
}
public static void ShowError(Exception ex) {
FacesMessage msg=new FacesMessage(FacesMessage.SEVERITY_ERROR,ex.getMessage(),"Error Message");
FacesContext.getCurrentInstance().addMessage(null, msg);
}
Now use it in the xhtml file as follows: