1.0 1.1 jndi http://jakarta.apache.org/taglibs/jndi JNDI Tag library (Beta 1) A tag library for using the Java Naming and Directory Interface (JNDI). useContext org.apache.taglibs.jndi.UseContextTag org.apache.taglibs.jndi.UseContextTEI JSP useContext This tag creates an instance of a javax.naming.Context based on the values of the attributes providing some of the standard values. In addition to the System properties and the jndi.properties, some standard properties are scanned in the pageContext attributes.
  • note: should this be extended to the servlet init params as well?
  • note: as of right now this does not look into the id and scope to see if the context already exists, so it does not behave entirely like useBean
One of the following three attributes must be specified:
  • env
  • envRef
  • url
And one of the following three attributes must be specified: One of the following three attributes must be specified:
  • initialFactory
  • providerUrl
  • url
Create a javax.naming.Context object for use after tag close. envRef false false This is the name of an attribute that will be searched for that provides additional environment information. This info is subordinate to the info provided by the attributes to this tag. env false true Same as envRef, except that the value is of type java.util.Hashtable. url false true If provided, the context created by the other attributes is used to create a context in which the parameter of this attribute is used to preform a lookup(String) operation. The context returned from the lookup will be the context returned by the tag. providerUrl false true Provides the value of the Context.PROVIDER_URL attribute to the InitialContext environment Hashtable. initialFactory false true Provides the value of the Context.INITIAL_CONTEXT_FACTORY attribute to the InitialContext environment Hashtable. dnsUrl false true Provides the value of the Context.DNS_URL attribute to the InitialContext environment Hashtable. authoritative false true Provides the value of the Context.AUTHORITATIVE attribute to the InitialContext environment Hashtable. batchsize false true Provides the value of the Context.BATCHSIZE attribute to the InitialContext environment Hashtable. objectFactories false true Provides the value of the Context.OBJECT_FACTORIES attribute to the InitialContext environment Hashtable. stateFactories false true Provides the value of the Context.STATE_FACTORIES attribute to the InitialContext environment Hashtable. urlPkgPrefixes false true Provides the value of the Context.URL_PKG_PREFIXES attribute to the InitialContext environment Hashtable. id true false The name that the context is to be exported as. (A potential future relaxation may make this optional, but it will only be available to body content enclosed that asks for an implicit context) scope false false The scope the object is to be exported as. Default is 'page'. Follows the JSP spec conventions.
list org.apache.taglibs.jndi.ListTag org.apache.taglibs.jndi.ListTEI JSP list This tag iterates through the list returned by Context.list() and the body content is evaluated for each iteration. One of the following two attributes must be specified:
  • context
  • contextRef
Lists the elements in a particular javax.naming.Context contextRef false true Attribute name that will be searched for to provide the context. context false true A literal instance of type javax.naming.Context to be used. nameId false true The attribute name of the name listing to be exported nameScope false true The scope that the name object will be exported to (page is the default). classId false true The attribute name of the class name to be exported. classScope false true The scope that the class name will be exported to (page is the default). objId false true The attribute name of the bound object listing to be exported. objScope false true The scope that the bound object will be exported to (page is the default). name false true The name to preform the list against. nameObject false true Like name, a literal javax.naming.Name object to use to list against. If both this and name are specified and the value is not null, this attribute is the one used. bindings false true Whether or not bound objects are returned, true or false.
lookup org.apache.taglibs.jndi.LookupTag org.apache.taglibs.jndi.LookupTEI JSP lookup Lookups and exports a particular entry in a javax.naming.Context. One of the following two attributes must be specified:
  • context
  • contextRef
This looks up a particular object and exports it. contextRef false true Attribute name that will be searched for to provide the context. context false true A literal instance of type javax.naming.Context to be used. id true false Attribute name of the object to be exported. scope false false The scope the object is to be exported as. Default is 'page'. Follows the JSP spec conventions. name false true The name to preform the lookup against. nameObject false true Like name, a literal javax.naming.Name object to use to lookup. If both this and name are specified and the value is not null, this attribute is the one used. type false false The class to cast the looked up object to. Right now failure to cast results in a null return. The default is java.lang.Object. This also determines the type of the exposed scripting variable. [Adding an attribute failure with string values null, exception, or classcast to return null, throw a JSPExceptionm or to re-throw the class-cast is a thought.]
useDirContext org.apache.taglibs.jndi.UseDirContextTag org.apache.taglibs.jndi.UseDirContextTEI JSP useDirContext This behaves exactly like useContext except that the object exported will be of type javax.naming.directory.DirContext and the InitialDirContext will be used to generate the contexts. One of the following three attributes must be specified:
  • env
  • envRef
  • url
And one of the following three attributes must be specified: One of the following three attributes must be specified:
  • initialFactory
  • providerUrl
  • url
Create a javax.naming.directory.DirContext object for use after tag close. envRef false false This is the name of an attribute that will be searched for that provides additional environment information. This info is subordinate to the info provided by the attributes to this tag. env false true Same as envRef, except that the value is of type java.util.Hashtable. url false true If provided, the context created by the other attributes is used to create a context in which the parameter of this attribute is used to preform a lookup(String) operation. The context returned from the lookup will be the context returned by the tag. providerUrl false true Provides the value of the Context.PROVIDER_URL attribute to the InitialContext environment Hashtable. initialFactory false true Provides the value of the Context.INITIAL_CONTEXT_FACTORY attribute to the InitialContext environment Hashtable. dnsUrl false true Provides the value of the Context.DNS_URL attribute to the InitialContext environment Hashtable. authoritative false true Provides the value of the Context.AUTHORITATIVE attribute to the InitialContext environment Hashtable. batchsize false true Provides the value of the Context.BATCHSIZE attribute to the InitialContext environment Hashtable. objectFactories false true Provides the value of the Context.OBJECT_FACTORIES attribute to the InitialContext environment Hashtable. stateFactories false true Provides the value of the Context.STATE_FACTORIES attribute to the InitialContext environment Hashtable. urlPkgPrefixes false true Provides the value of the Context.URL_PKG_PREFIXES attribute to the InitialContext environment Hashtable. id true false The name that the context is to be exported as. (A potential future relaxation may make this optional, but it will only be available to body content enclosed that asks for an implicit context) scope false false The scope the object is to be exported as. Default is 'page'. Follows the JSP spec conventions.
search org.apache.taglibs.jndi.SearchTag org.apache.taglibs.jndi.SearchTEI JSP search Performs a search against a DirContext according to the semantics of the search(Name name, String filter, SearchControls cons) in javax.naming.directory.DirContext. One of the following two attributes must be specified:
  • context
  • contextRef
Searches a DirContext. id true false Attribute name of the SearchResult to be exported. scope false false The scope the object is to be exported as. Default is 'page'. Follows the JSP spec conventions. contextRef false true Attribute name that will be searched for to provide the context. context false true A literal instance of type javax.naming.Context to be used. name false true The name to preform the lookup against. nameObject false true Like name, a literal javax.naming.Name object to use to lookup. If both this and name are specified and the value is not null, this attribute is the one used. filter true true The LDAP-style search filter to use. countLimit false true The maximum number of entries to return. Default is 0 which _should_ mean return all entries found (but behavior has been observerved in some provider/server combinations to mean none). derefLink false true Determines whether links will be dereferenced during the search. Set to true or false, default is false. attributes false true A (generally) comma seperated list of attributes to return in the search results. Default is null which means return all. attributeSeparator false true If comma seperated attributes won't do, provides an alternate delimiter string for the attributes attribute. Default is ",". bindings false true Whether or not to return bound objects. Set to true or false, default is false. searchScope false true What scope the search is to be preformed against. One of subtree, subtree_scope, onelevel, onelevel_scope, object, object_scope. (The variants are treated as the the _scope variants). timeLimit false true The time limit in ms to wait. 0 means wait indefinatly.
getAttribute org.apache.taglibs.jndi.GetAttributeTag org.apache.taglibs.jndi.GetAttributeTEI JSP getAttribute This is a flexible tag to get an attribute. The specified object can be a DirContext, SearchResult, Attributes, or an Attribute. If the object is a DirContext an Attributes object is retrieved with just the requested attribute, and then further processed. If it is a SearchResult then the return of getAttributes is processed further. For any Attributes object passed in explicitly or derived the get(attribute) method is executed and stored as the attribute. The contents of the attribute are processed in one of three ways depending on the value of the multivalue tag attribute. If the value is 'one' then the value returned by Attribute.get() is written to the output stream and the body is skipped. For 'separator' then the body of the tag servers as a separator for the attribute values in the event of multivalue attributes, but it is skipped in the event of a singly valued or non-existant attribute, and the value of the attribute is explicitly written to the appropriate output stream. And for the case of 'iterate' the the contents of the body are iterated over for each value of the attribute, whether singly valued or multi-valued (and skipped for a non-existant attribute). In all cases the attribute is exported to the id and scope if provided at the beginning of the tag, so it is available both within the tag and after it's execution. Extracts an attribute from a DirContext, a SearchResult, or an Attributes. id flase false Page Context attribute name of the actual Attribute value to be exported. For multivalued attributes where the multivalue mode is 'separator' no attribute is exported, while for the value of 'iterator' it is the current value inside the body content or the final value outside the tag. For 'one' it is the only value of the attribute. scope false false The scope the object is to be exported as. Default is 'page'. Follows the JSP spec conventions. ref false true A refrence to a PageContext attribute to be searched for to use as the object to preform attribute operations against. object false true A literal instance of an object to have the attribute operations applied against. An invalid object type will result in the body content being skipped an no output being written to the output stream. attribute false false The name of the attribute to use for objects of type DirContext, SearchResult and Attributes. Ignored for object of type Attribute. multivalue false true One of 'one', 'separator', or 'iterate'. Se tag description for details. forEachAttribute org.apache.taglibs.jndi.ForEachAttributeTag org.apache.taglibs.jndi.ForEachAttributeTEI JSP forEachAttribute This tag allows you to iterate through all of the attribute names returned for a DirContext, SearchResult, or an Attributes object. Iterates attributes form a DirContext, Attributes, or SearchResult. id true false Page Context attribute name of the actual Attribute to be exported. This is the name exposed within the tag Body and after. It is the Attribute object and not the value of the attribute. scope false false The scope the object is to be exported as. Default is 'page'. Follows the JSP spec conventions. ref false true A refrence to a PageContext attribute to be searched for to use as the object to preform attribute operations against. Valid types are DirContext, SearchResults, and Attributes. object false true A literal instance of an object to have the attribute operations applied against. An invalid object type will result in the body content being skipped an no output being written to the output stream. Valid types are DirContext, SearchResults, and Attributes.