KickJava   Java API By Example, From Geeks To Geeks.

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


1 package net.simya.ldap.taglib;
2
3 import javax.servlet.jsp.tagext.*;
4 import javax.servlet.jsp.*;
5 import javax.naming.NamingException JavaDoc;
6 import javax.naming.directory.Attribute JavaDoc;
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 JavaDoc DEFAULT_DELIMITER = ", ";
14     private static final String JavaDoc DEFAULT_MIMETYPE = "text/plain";
15     private static final String JavaDoc DEFAULT_MIMETEXT = "text";
16     private static final int DEFAULT_INDEX = -1;
17     private static final String JavaDoc DEFAULT_VALUE = "";
18     
19     private String JavaDoc name = null;
20     private String JavaDoc value = null;
21     private String JavaDoc 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 JavaDoc getName() { return this.name; }
45     public void setName(String JavaDoc name) { this.name = name; }
46
47     public String JavaDoc getValue() { return this.value; }
48     public void setValue(String JavaDoc value) { this.value = value; }
49
50     public String JavaDoc getMimeType() { return this.mimeType; }
51     public void setMimeType(String JavaDoc mimeType) { this.mimeType = mimeType; }
52 }
Popular Tags