I have an Enum like this
package com.example;
public enum CoverageEnum {
COUNTRY,
REGIONAL,
COUNTY
}
I would like to iterate
If you are using Tag Libraries you could encapsulate the code within an EL function. So the opening tag would become:
EDIT: In response to discussion about an implementation that would work for multiple Enum types just sketched out this:
public static > Enum[] getValues(Class klass) {
try {
Method m = klass.getMethod("values", null);
Object obj = m.invoke(null, null);
return (Enum[])obj;
} catch(Exception ex) {
//shouldn't happen...
return null;
}
}