• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to populate elements in selectManyListbox as selected

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic