Java Reference
In-Depth Information
The LDAPInsert Service
The LDAP class is also an implementation of the Service interface. Its execute() method starts
its execution when a user selects the Add link from the navigation.jsp page and submits the
completed form on the insert.jsp page. It then gets the required attributes to create a new
People object and calls the LDAPManager.add() method with a HashMap filled with the
retrieved attributes. The source for the LDAPInsert service is in Listing 21.7.
L ISTING 21.7
LDAPInsert.java
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletContext;
import LDAPManager;
public class LDAPInsert implements Service {
public LDAPInsert() {
}
/**
* Single method to become a service.
*
* @throws Exception if any exceptions need to be thrown back
* to the calling Controller.
*/
public void execute(HttpServletRequest request,
HttpServletResponse response,
ServletContext context) throws Exception {
String[] objectClass = {“top”,
“person”,
“organizationalPerson”,
“inetOrgPerson”};
// Get the uid off of the request
String uid = request.getParameter(“uid”);
// Get the sn off of the request
String sn = request.getParameter(“sn”);
Search WWH ::




Custom Search