Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example;
- public enum CoverageEnum {
- COUNTRY,
- REGIONAL,
- COUNTY
- }
- <c:forEach var="type" items="<%= com.example.CoverageEnum.values() %>">
- ${type}
- </c:forEach>
- <c:forEach var="type" items="${myprefix:getValues()}">
- 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;
- }
- }
- <form:form method="post" modelAttribute="cluster" cssClass="form" enctype="multipart/form-data">
- <form:label path="clusterType">Cluster Type
- <form:errors path="clusterType" cssClass="error" />
- </form:label>
- <form:select items="${clusterTypes}" var="type" path="clusterType"/>
- </form:form>
- @ModelAttribute("clusterTypes")
- public MyClusterType[] populateClusterTypes() {
- return MyClusterType.values();
- }
Add Comment
Please, Sign In to add comment