KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.util.Hashtable JavaDoc;
7
8 public class Property
9        extends TagSupport
10 {
11     private String JavaDoc name = null;
12     private String JavaDoc value = null;
13     private static Hashtable JavaDoc preDefinedNames = new Hashtable JavaDoc();
14     
15     static
16     {
17         preDefinedNames.put( "factory", Context.INITIAL_CONTEXT_FACTORY );
18         preDefinedNames.put( "url", Context.PROVIDER_URL );
19         preDefinedNames.put( "dn", Context.SECURITY_PRINCIPAL );
20         preDefinedNames.put( "password", Context.SECURITY_CREDENTIALS );
21         preDefinedNames.put( "ssl", Context.SECURITY_PROTOCOL );
22         preDefinedNames.put( "referral", Context.REFERRAL );
23         preDefinedNames.put( "authtype", Context.SECURITY_AUTHENTICATION );
24     }
25     
26     public int doStartTag()
27     throws JspException
28     {
29          if ( preDefinedNames.containsKey( name ) )
30             pageContext.setAttribute( (String JavaDoc)preDefinedNames.get( name ), value );
31         else
32             pageContext.setAttribute( name, value );
33        return EVAL_PAGE;
34     }
35     
36     public void release()
37     {
38         name = null;
39         value = null;
40     }
41
42     public String JavaDoc getName() { return this.name; }
43     public void setName(String JavaDoc name) { this.name = name; }
44
45     public String JavaDoc getValue() { return this.value; }
46     public void setValue(String JavaDoc value) { this.value = value; }
47 }
Popular Tags