O'Reilly logo

PrimeFaces Cookbook by Mert Çalışkan, Oleg Varaksin

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

Listing data with pickList

pickList is a dual list input component that is used for transferring data between two different collections with drag-and-drop based reordering, transition effects, POJO support, client-server callbacks, and more.

How to do it...

pickList uses a custom data model, which is an instance of org.primefaces.model.DualListModel that contains two lists—one for the source and one for the target. For a pickList implementation that would be used to select countries, the data model could be as follows:

private List<String> countriesSource = new ArrayList<String>(); private List<String> countriesTarget = new ArrayList<String>(); countriesSource.add("England"); countriesSource.add("Germany"); countriesSource.add("Switzerland"); countriesSource.add("Turkey"); ...

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