1 16 17 package org.apache.taglibs.jndi; 18 19 import javax.servlet.jsp.*; 20 import javax.servlet.jsp.tagext.*; 21 22 import java.util.Hashtable ; 23 import java.util.Enumeration ; 24 25 import javax.naming.*; 26 import javax.naming.directory.*; 27 28 33 public class UseDirContextTag extends UseContextTag { 34 35 public Class getClassOfExportedObject() { 36 return DirContext.class; 37 } 38 39 protected Object getObjectToExport() throws JspException 40 { 41 try { 42 Context ctx = new InitialDirContext(env); 43 if (url != null) { 44 Object o = ctx.lookup(url); 45 if (o instanceof DirContext) { 46 ctx = (DirContext) o; 47 } 48 } 49 return ctx; 50 } catch (NamingException ne) { 51 throw new JspException(ne.toString()); 53 } 54 } 55 56 59 } 60 | Popular Tags |