How can I use LDAP with JSP?

Jorge Jordão

To use LDAP within Java (JSP or not), you must use JNDI (Java Naming and Directory Interface).

A bit like JDBC, JNDI consists of

  • A list of packages: javax.naming, javax.naming.directory, javax.naming.event and javax.naming.ldap, all included with JDK 1.3 and also available separately at java.sun.com.
  • Service providers (instead of drivers) that actually implement a given naming or directory service (LDAP, DNS, File system, etc).

Check out the JNDI Tutorial for more information.