posted 15 years ago
Hi all,
I'd like someone to advise me how to have (only) some entries in selectManyListbox selected. I have many-to-many relationship between Clients and Products, and when I was adding new Client I was populating selectManyListbox with all the available Products. Everything was correctly inserted into database, and now I am trying to create edit page. This selectManyListbox should contain all the available products (like before), but I would like to have Client's products selected. So in the backing bean I have list with all the products in form of List<SelectItem> (used earlier when adding), and I have List<Product> retrieved from the database. SelectItem entries where created using product id and name (ie, new SelectItem(product.getId(),product.getName())). And I don't know how to combine them to have what I described earlier. <f:selectedItem> and <f:selectedItems> don't even have 'selected' attribute, or something similar. BTW, I am using MyFaces 1.2 and Facelets.
Regards, Ben.