1 package net.simya.ldap.taglib; 2 3 import javax.servlet.jsp.tagext.*; 4 import javax.servlet.jsp.*; 5 import javax.naming.NamingException ; 6 import javax.naming.directory.Attribute ; 7 import net.simya.ldap.beans.*; 8 import net.simya.ldap.servlet.*; 9 10 public class AddAttribute 11 extends TagSupport 12 { 13 private static final String DEFAULT_DELIMITER = ", "; 14 private static final String DEFAULT_MIMETYPE = "text/plain"; 15 private static final String DEFAULT_MIMETEXT = "text"; 16 private static final int DEFAULT_INDEX = -1; 17 private static final String DEFAULT_VALUE = ""; 18 19 private String name = null; 20 private String value = null; 21 private String mimeType = DEFAULT_MIMETYPE; 22 23 public int doStartTag() 24 throws JspException 25 { 26 Add addTag = (Add) getParent(); 27 28 if ( addTag == null ) 29 throw new JspTagException( "<add attribute> tag should be child node of <add> tag." ); 30 31 32 addTag.setAttribute(name,value); 33 34 return EVAL_BODY_INCLUDE; 35 } 36 37 public void release() 38 { 39 name = null; 40 value = null; 41 mimeType = DEFAULT_MIMETYPE; 42 } 43 44 public String getName() { return this.name; } 45 public void setName(String name) { this.name = name; } 46 47 public String getValue() { return this.value; } 48 public void setValue(String value) { this.value = value; } 49 50 public String getMimeType() { return this.mimeType; } 51 public void setMimeType(String mimeType) { this.mimeType = mimeType; } 52 } | Popular Tags |