1 package net.simya.ldap.taglib; 2 3 import javax.servlet.jsp.tagext.*; 4 import javax.servlet.jsp.*; 5 import javax.naming.Context ; 6 import javax.naming.directory.DirContext ; 7 import javax.naming.NamingException ; 8 import net.simya.ldap.beans.*; 9 10 public class Modify 11 extends BodyTagSupport 12 { 13 private String 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 ex ) 40 { 41 throw new LdapTaglibException( ex ); 42 } 43 return SKIP_BODY; 45 } 46 47 public void release() 48 { 49 dn = null; 50 } 51 52 public String getDn() { return this.dn; } 53 public void setDn(String dn) { this.dn = dn; } 54 55 public void setAttribute(String name, String value, int modType) 56 { 57 modifyBean.setModifyAttribute(name,value,modType); 58 } 59 } 60 | Popular Tags |