Calling an LDAP Java Applet from JavaScript

This page demonstrates how to call an LDAP Java applet from JavaScript. You should set this page up to be served by a machine running a web server and a directory server. (The web server is needed to serve this page.) You also need to do the following:

  1. Edit this page. Change the value of the host parameter for the applet to the name of your host machine.
  2. In the JavaScript code embedded in this page, change any distinguished names and search bases to fit the data in your directory server.
  3. Copy this file and the LDAPApplet.java file to a directory served by your Web server.
  4. Compile the LDAPApplet.java source file into a class file.

Note that when you compile the Java applet, you will need the netscape.security classes in your CLASSPATH environment variable. These classes are in the java40.jar file provided with Netscape Communicator.

Reading an entry

To read an entry and list all attributes, enter a distinguished name and press "readDN". An example of an entry in the demo database is:

uid=jvedder,ou=People,o=airius.com

Distinguished name


Searching

To search, enter a base, a filter and press "search". The radio buttons determine whether "distinguished names" or "common names" are displayed in the results. Examples of directory bases in the demo database:

ou=People,o=airius.com
o=airius.com

An example of a filter (to find all entries with a "Common Name" starting with "r") is:

cn=r*

Search base

Search filter

Show Distinguished names Show Common names