aspose file tools
The moose likes Struts and the fly likes Using Enum with html:select Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Using Enum with html:select" Watch "Using Enum with html:select" New topic
Author

Using Enum with html:select

Jason Ferguson
Ranch Hand

Joined: Sep 16, 2007
Posts: 47
Given a simple enum class:



Can I use this enum to generate the values for an html ptions tag?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26193
    
  66

Jay,
Are you looking to get the ids or descriptions in the options? UnitOfIssue.values() will give you a collection of the ids.

I can't think of a way to get a collection of descriptions without writing some code in the action. It isn't hard code to write of course. Just a loop to build the collection and then stick it in the request/session.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Using Enum with html:select
 
Similar Threads
call constructor from super-enum
JAXB annotation problem/question
Enum
Get records using DBUtils
Criteria API