code: public static final boolean setSelectedValue(ListBox list, String value, boolean addMissingValues) {
  	if (value == null) {
  	    list.setSelectedIndex(0);
  	    return false;
  	}
  	else {
  	    int index = findValueInListBox(list, value);
  	    if (index >= 0) {
  		list.setSelectedIndex(index);
  		return true;
  	    }
  
  	    if (addMissingValues) {
  		list.addItem(value, value);
  
  		// now that it's there, search again
  		index = findValueInListBox(list, value);
  		list.setSelectedIndex(index);
  		return true;
  	    }
  
  	    return false;
  	}
      }
docs: Utility function to set the current value in a ListBox.
  
  @return returns true if the option corresponding to the value
  was successfully selected in the ListBox