RichFaces provide a autocomplete component, is called RichFaces Autocomplete.
In the link, you can see the second example, using ',' or ' ' you can select many values.
<rich:autocomplete mode="cachedAjax" tokens=", " minChars="1"
autofill="false"
autocompleteMethod="#{autocompleteBean.autocomplete}" />
In the Showcase source, you can see the bean implementation
public List<String> autocomplete(String prefix) {
ArrayList<String> result = new ArrayList<String>();
if ((prefix == null) || (prefix.length() == 0)) {
for (int i = 0; i < 10; i++) {
result.add(capitals.get(i).getState());
}
} else {
Iterator<Capital> iterator = capitals.iterator();
while (iterator.hasNext()) {
Capital elem = ((Capital) iterator.next());
if ((elem.getState() != null && elem.getState().toLowerCase().indexOf(prefix.toLowerCase()) == 0)
|| "".equals(prefix)) {
result.add(elem.getState());
}
}
}
Sorry for my bad english. Cheers.