This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes Enums in JSPs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Enums in JSPs" Watch "Enums in JSPs" New topic
Author

Enums in JSPs

Ryan Kade
Ranch Hand

Joined: Aug 16, 2005
Posts: 69
Did some searching both in the forums and Google and didn't find a good answer to this question: how do I access an enum using EL in JSP? Is it even possible?

If I have an enum:



I'd like to be able to access it in the JSP:



Any suggestions?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

Not possible. The EL is geared towards beans and their properties.

I came up with a solution for class constants as outlined in this article, perhaps a similar tactic for enums would work?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Enums in JSPs
 
Similar Threads
Problem with nested c:forEach
How to pass attribute to a custom tag only if it evaluates to a non null value
JSP taking long time to load
JSTL if statement does not work
JSP and String manipulation