Running a Search Against LDAP

I l @ ve RuBoard

With a large piece of the company gone, it hardly seems worthwhile, but IT decides to continue on with its LDAP project and writes a page to list the company phone directory (not the wisest thing to do, perhaps, given that someone seems to be using it to recruit the company's personnel, but what the heck!).

The phone list page is simplicity itself (see Listing 15.7). It gets an iterator over the vector of employees returned from the getAllEmployees call and then displays a table (shown in Figure 15.13). You can see that Al is there, along with a large number of his relatives whom he has hired , all named Al. These are artifacts of the development process, when a large number of records got inserted during unit testing.

Figure 15.13. The employee listing.

graphics/15fig13.jpg

Listing 15.7 testLdapSearch.jsp
 <%@ page import="com.bfg.employee.Employee" %> <%@ page import="java.util.Iterator" %> <HEAD><TITLE>Employee Directory</TITLE></HEAD><BODY> <TABLE WIDTH="75%" BORDER=1>   <TR><TH>Last Name</TH><TH>First Name</TH><TH>Title</TH><TH>Ext</TH></TR> <% Iterator employees = Employee.getAllEmployees().iterator(); while (employees.hasNext()) {     Employee e = (Employee) employees.next(); %>      <TR><TD><%= e.getLastName() %></TD>      <TD><%= e.getFirstName() %></TD>      <TD><%= e.getTitle() %></TD>      <TD><%= e.getTelephoneNumber() %></TD></TR> <% } %> </TABLE> </BODY> 
I l @ ve RuBoard


MySQL and JSP Web Applications. Data-Driven Programming Using Tomcat and MySQL
MySQL and JSP Web Applications: Data-Driven Programming Using Tomcat and MySQL
ISBN: 0672323095
EAN: 2147483647
Year: 2002
Pages: 203
Authors: James Turner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net