KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > simya > ldap > taglib > Modify


1 package net.simya.ldap.taglib;
2
3 import javax.servlet.jsp.tagext.*;
4 import javax.servlet.jsp.*;
5 import javax.naming.Context JavaDoc;
6 import javax.naming.directory.DirContext JavaDoc;
7 import javax.naming.NamingException JavaDoc;
8 import net.simya.ldap.beans.*;
9
10 public class Modify
11        extends BodyTagSupport
12 {
13     private String JavaDoc dn = null;
14     private LdapModifyEntryBean modifyBean = new LdapModifyEntryBean();
15
16     public int doStartTag()
17     throws JspException
18     {
19         Connect connectTag = (Connect) getParent();
20         if ( connectTag == null )
21             throw new JspTagException( "<modify> tag should be child node of <connect> tag." );
22
23         modifyBean.setDN( dn );
24         modifyBean.setContext( connectTag.getContext() );
25
26         if ( id != null )
27             pageContext.setAttribute( id, modifyBean );
28
29         return EVAL_BODY_TAG;
30     }
31
32     public int doAfterBody()
33     throws JspException
34     {
35         try
36         {
37             modifyBean.modifyEntry();
38
39         } catch ( NamingException JavaDoc ex )
40         {
41             throw new LdapTaglibException( ex );
42         }
43         //body.clearBody();
44
return SKIP_BODY;
45     }
46
47     public void release()
48     {
49         dn = null;
50     }
51
52     public String JavaDoc getDn() { return this.dn; }
53     public void setDn(String JavaDoc dn) { this.dn = dn; }
54
55     public void setAttribute(String JavaDoc name, String JavaDoc value, int modType)
56     {
57         modifyBean.setModifyAttribute(name,value,modType);
58     }
59 }
60
Popular Tags