Java Reference
In-Depth Information
public int getSearchScope() {
return searchScope;
public void setSearchScope(int sc) {
searchScope = sc;
Accessing LDAP from a Servlet
By using the LDAP manager class that we have developed, accessing the LDAP server from
any servlet is very simple. You acquire all the information you need to perform the specific
operation and then make the appropriate call to LDAPManager .
If you download the source code for this topic, an extra class is provided to help load several
people into a LDAP server. This class is named LDAPInsertData . All you need to do is com-
pile it and run it to insert 14 people into the server. This will work as long as you have installed
the root of your LDAP tree as “” . The source code for LDAPInsertData appears
in Listing 11.3.
import java.util.HashMap;
import javax.naming.NamingException;
public class LDAPInsertData {
public LDAPInsertData() {
public static void main(String[] args) {
LDAPManager lm = new LDAPManager();
String[] objectClass = {“top”,
Search WWH ::

Custom Search