A very simple example of fetching all matching LDAP entries (distinguished names only). The LDAPGetEntries JavaBean is used. JavaScript fetches user-entered values and retrieves all matching entres from the specified directory, by setting properties on LDAPGetEntries and calling its getEntries() method.

Examples of filters to test:
objectclass=person
objectclass=organization
objectclass=groupOfUniqueNames
cn=*Jensen
Host:
Port:
Directory base:
Filter:

The JavaScript code to do this is as follows:

	// Create an instance of the Bean
	getter = new netscape.ldap.beans.LDAPGetEntries();
	// Get parameters from form fields
	getter.setHost( document.input.host.value );
	getter.setPort( parseInt(document.input.port.value) );
	getter.setBase( document.input.base.value );
	getter.setFilter( document.input.filter.value );
	// Do we need privileges for network connections?
    host = netscape.application.AWTCompatibility.awtApplet().getCodeBase().getHost();
	if ( host != document.input.host.value )
		netscape.security.PrivilegeManager.enablePrivilege("UniversalConnect");
	// Do the search
	values = getter.getEntries();
	// Display the results
	showStrings( values );