Hi everybody,

I'm actually using LdapTemplate to search some user account and display them through a web page.

My code seems as below:

Code:
public SearchControls getControls() {
		controls = new SearchControls();
		controls.setCountLimit(10);
		controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
		return controls;
}

public List searchAccounts(String login){
		
		// Filters
		AndFilter filter = new AndFilter();
		filter.and(new EqualsFilter("objectclass", "inetOrgPerson"));
		filter.and(new EqualsFilter("cn", login));
		
		return ldapTemplate.search("", filter.encode(), controls, new AccountMapper());
	}

The search works fine, but only if the filter is precise.

Per example,
if the filter is "toto", ldaptemplate will found one or several results with a login "toto".
if the filter is "to" or "to*", ldaptemplate will not found results.

How can i implement an imprecise search? i want to be able to search an account with a not specific term.

Thanks all !