• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to populate elements in selectManyListbox as selected

 
Venu Babu Ravi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Can any one help me how to populate elements in selectManyListbox with elements as selected?

I have following code in jsp.
-------------------------------

I have following code in Bean
---------------------------------


The property name is vendorCategory.

i am able to populate the data in selectManyListbox but it is not showing as selected.

Thanks in advance...
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18154
52
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Venu! at last I've found someone who does more method chaining than I do!

Seriously, you might want to break some of that code down into smaller sequences. It makes it more readable, and if you're using a debugger it's easier to follow the data. Nothing is more annoying than a NullPointerException that could have come from somewhere in a sequence of method calls, but you don't know which method call returned null.

There's a "Code" button on the JavaRanch message editor that can help make your code examples more readable. I've edited your message to include it.

The selectOne/SelectMany JSF controls cannot take a simple array or list of Strings. That's because there are 2 separate data elements that go into the generated HTML <SELECT> option elements - one for the display value and one for the returned data value. So you have to build up a collection of JSF SelectItem objects to serve as the display model for those controls.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic