O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – using the MultiSelectListbox component

Let us see how to create a MultiSelectListbox component to display categories and its subcategories based on the selected category, by performing the following steps:

  1. Instantiate List<SelectItem> instances with details of categories and subcategories:
    public class CatalogController { private List<SelectItem> categories; private String selectedCategory; public CatalogController() { categories = new ArrayList<SelectItem>(); SelectItemGroup homeAppliancesGrp = new SelectItemGroup("Home Appliances"); SelectItemGroup homeDecorGrp = new SelectItemGroup("Home & Decor"); SelectItem clocks = new SelectItem("Wall Clocks"); SelectItem candleHolders = new SelectItem("Candle Holders"); SelectItem artPrints ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required