• Post Reply Bookmark Topic Watch Topic
  • New Topic

Simplifying list of "time" options with jsp

 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to "clean up" a cluttered mess of html, scriptlets, and javascript using some jsp tags. The first thing I noticed was a long list of options signifying time of day (spaced 15 minutes apart, starting at 4am and ending at 11:45pm). Is there a way to rewrite this using jsp? The code is as follows:



Any help would be greatly appreciated, thank you!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For this sort of thing (statically defined options) I usually define a sorted Map and use it to populate the option elements. The Map key serves as the option value, and the Map value as the display text for the option.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!