A way to do that is shown in the wiki page of the pluguin where it says: Autocompleter that handle a JSON Result. Yo just set that code in your jsp, and then you implement something like this in your action:
private static String[] staticLanguages = { ...a list... };
private String term;
private String[] languages = Autocompleter.staticLanguages;
public String execute() throws Exception {
if (term != null && term.length() > 1)
{
ArrayList<String> tmp = new ArrayList<String>();
for (int i = 0; i < staticLanguages.length; i++)
{
if (StringUtils.contains(staticLanguages[i].toLowerCase(), term.toLowerCase()))
{
tmp.add(staticLanguages[i]);
}
}
languages = tmp.toArray(new String[tmp.size()]);
}
return SUCCESS;
}
Just change StringUtils.contains line and check instead if the begining is the same.
The jsp tag would be:
<sj:autocompleter
name="term"
id="languages"
href="%{remoteurl}"
delay="50"
loadMinimumCount="2"
/>
I think this should work. Just take a look at the example code in the wiki and try it out.