This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using Enum with html:select

 
Jason Ferguson
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given a simple enum class:



Can I use this enum to generate the values for an html ptions tag?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic