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

JSF: Show me a better way

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am filling list boxes with data from a database. Nothing new there. But it seems really messy the way I am doing it now. I have a list that holds a list of hardware items (motherboard, harddrive, etc). I am using Hibernate so this is my method to retrieve my list:



This return a java.util.List of Hardware objects. I return that list to one of my backing beans and in order to fill the list I have this method:



And then in my JSF page



My getHardwareList method is the nastiest thing I have seen in a while. Is there a better way to do this?
 
Dave Wood
bronco
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that's pretty much what you need...though it might be a bit less ugly like this...



or, better yet, in Tiger:



 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dave. I will give that a shot. The Tiger way looks best to me.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic