<p>I have an Enum like this</p>

<pre><code>package com.example;

public enum CoverageEnum {

    COUNTRY,
    REGIONAL,
    COUNTY
}
</code></pre>

<p>I would like to iterate over these constants in JSP without using scriptlet code. I know I can do it with scriptlet code like this:</p>

<pre><code>&lt;c:forEach var="type" items="&lt;%= com.example.CoverageEnum.values() %&gt;"&gt;
    ${type}
&lt;/c:forEach&gt;
</code></pre>

<p>But can I achieve the same thing without scriptlets?</p>

<p>Cheers,
Don</p>

If you are using Tag Libraries you could encapsulate the code within an EL function. So the opening tag would become:
```
```
<c:forEach var="type" items="${myprefix:getValues()}">
```
```
EDIT: In response to discussion about an implementation that would work for multiple Enum types just sketched out this:
```
```
public static <T extends Enum<T>> Enum<T>[] getValues(Class<T> klass) {
    try { 
        Method m = klass.getMethod("values", null);
        Object obj = m.invoke(null, null);
        return (Enum<T>[])obj;
    } catch(Exception ex) {
        //shouldn't happen...
        return null;
    }
}
```
```