using Java 5 enums on JSTL page

Hi,Anyone any idea how to get at enums on a JSTL page, without using scriptlets? The dot notation doesn't appear to work.regards,dig
[161 byte] By [diggerdiga] at [2007-10-2 20:09:28]
# 1

I don't think there is one directly.

enums were new with java1.5, and I don't think it has quite caught up.

However JSTL also doesn't deal with constants very well.

Probably your best bet would be to use the EnumMap and EnumSet classes to expose a set/map of the enum onto the page.

JSTL could at least deal with those.

What exactly are you trying to accomplish with the enum on the JSP page?

evnafetsa at 2007-7-13 22:49:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

I want to be able to compare strings on JSP pages with the string values of enums

e.g.

<c:if test=${stringValue eq enum.toString } />

or something similar to that. I want to avoid using magic strings on the JSP page.

Is this possible?

diggerdiga at 2007-7-13 22:49:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
You might find [url http://www.javaranch.com/journal/200601/Journal200601.jsp#a3]this article[/url] of interest. It applies to constants, but might be expanded on to work for enums as well.
evnafetsa at 2007-7-13 22:49:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Sounds like there is nothing concrete in JSTL for this. Enum maps might be the way to go.Thanks for the pointers.
diggerdiga at 2007-7-13 22:49:58 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...