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 basic PickList component

Let us see how we can create a PickList component to grant and revoke privileges to and from users, by performing the following steps:

  1. Initialize DualListModel in the managed bean:
    public class PickListController 
    {
        private DualListModel<String> privileges;
        public PickListController() 
        {
            
            List<String> privilegesSource = new ArrayList<String>();
            List<String> privilegesTarget = new ArrayList<String>();
    
            privilegesSource.add("Create User");
            privilegesSource.add("Delete User");
            privilegesSource.add("Disable User");
            privilegesSource.add("Remove Buzz Post");
    
            privileges = new DualListModel<String>(privilegesSource, privilegesTarget);
        }
        //setter and getter for privileges
    }
  2. Use the <p:pickList> component to ...

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