Testing LDAP Reading

After building and compiling the Employee bean, you can test it with some standalone JSP pages. To begin, see if you can read employee records out of the database (see Listing 15.4).

The test program takes an employee user ID as an argument and then uses the findEmployee method to look it up in LDAP. If an employee is found and returned, the code displays various pieces of information about that person (see Figure 15.5); otherwise it prints an error message.

Figure 15.5. Running testLdapRead.jsp.

Listing 15.4. testLdapRead.jsp
 <%@ page import="com.bfg.employee.Employee" %> <HEAD><TITLE>Look for employee test</TITLE></HEAD><BODY> ...

Get MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.