Testing LDAP Reading

I l @ ve RuBoard

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.

graphics/15fig05.jpg

Listing 15.4 testLdapRead.jsp
 <%@ page import="com.bfg.employee.Employee" %> <HEAD><TITLE>Look for employee test</TITLE></HEAD><BODY> <% Employee emp = Employee.findEmployee(request.getParameter("uid")); if (emp != null) { %> Found employee <%= emp.getFirstName() %> <%= emp.getLastName() %>!<P> First Name: <%= emp.getFirstName() %><BR> Last Name: <%= emp.getLastName() %><BR> Password: <%= emp.getPassword() %><BR> Title: <%= emp.getTitle() %><BR> Employee Num: <%= emp.getEmployeeNumber() %><BR> Telephone: <%= emp.getTelephoneNumber() %><P> <% }  else { %> Employee not found! <% }  %> </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