public with sharing class MultiselectExampleController { public SelectOption[] selectedContacts { get; set; } public SelectOption[] allContacts { get; set; } public String message { get; set; } public MultiselectExampleController() { selectedContacts = new List(); List contacts = [SELECT Name, Id FROM Contact]; allContacts = new List(); for ( Contact c : contacts ) { allContacts.add(new SelectOption(c.Id, c.Name)); } } public PageReference save() { message = 'Selected Contacts: '; Boolean first = true; for ( SelectOption so : selectedContacts ) { if (!first) { message += ', '; } message += so.getLabel() + ' (' + so.getValue() + ')'; first = false; } return null; } }