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 java.util.Hashtable ; 7 8 public class Property 9 extends TagSupport 10 { 11 private String name = null; 12 private String value = null; 13 private static Hashtable preDefinedNames = new Hashtable (); 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 )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 getName() { return this.name; } 43 public void setName(String name) { this.name = name; } 44 45 public String getValue() { return this.value; } 46 public void setValue(String value) { this.value = value; } 47 } | Popular Tags |