2010-04-14 - Jakarta Taglibs has been retired.

For more information, please explore the Attic.

Tag reference sheet

Tag library reference for the following tag libraries:

JNDI Tag library (Beta 1)

A tag library for using the Java Naming and Directory Interface (JNDI).

This is version 1.0.

  • forEachAttribute This tag allows you to iterate through all of the attribute names returned for a DirContext, SearchResult, or an Attributes object
  • getAttribute This is a flexible tag to get an attribute
  • list This tag iterates through the list returned by Context
  • lookup Lookups and exports a particular entry in a javax
  • search Performs a search against a DirContext according to the semantics of the search(Name name, String filter, SearchControls cons) in javax
  • useContext This tag creates an instance of a javax
  • useDirContext This behaves exactly like useContext except that the object exported will be of type javax

Required attributes are marked with a *

<jndi:forEachAttribute>

This tag allows you to iterate through all of the attribute names returned for a DirContext, SearchResult, or an Attributes object.

Can contain: JSP

Attributes

Name Description Type
id* 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. String
object 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. String
ref 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. String
scope The scope the object is to be exported as. Default is 'page'. Follows the JSP spec conventions. String

<jndi: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.

Can contain: JSP

Attributes

Name Description Type
attribute The name of the attribute to use for objects of type DirContext, SearchResult and Attributes. Ignored for object of type Attribute. String
id 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. String
multivalue One of 'one', 'separator', or 'iterate'. Se tag description for details. String
object 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. String
ref A refrence to a PageContext attribute to be searched for to use as the object to preform attribute operations against. String
scope The scope the object is to be exported as. Default is 'page'. Follows the JSP spec conventions. String

<jndi:list>

This tag iterates through the list returned by Context.list() and the body content is evaluated for each iteration.

Can contain: JSP

Attributes

Name Description Type
bindings Whether or not bound objects are returned, null or null. String
classId The attribute name of the class name to be exported. String
classScope The scope that the class name will be exported to (page is the default). String
context A literal instance of type javax.naming.Context to be used. String
contextRef Attribute name that will be searched for to provide the context. String
name The name to preform the list against. String
nameId The attribute name of the name listing to be exported String
nameObject 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. String
nameScope The scope that the name object will be exported to (page is the default). String
objId The attribute name of the bound object listing to be exported. String
objScope The scope that the bound object will be exported to (page is the default). String

<jndi:lookup>

Lookups and exports a particular entry in a javax.naming.Context.

Can contain: JSP

Attributes

Name Description Type
context A literal instance of type javax.naming.Context to be used. String
contextRef Attribute name that will be searched for to provide the context. String
id* Attribute name of the object to be exported. String
name The name to preform the lookup against. String
nameObject 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. String
scope The scope the object is to be exported as. Default is 'page'. Follows the JSP spec conventions. String
type 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.] String

<jndi: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.

Can contain: JSP

Attributes

Name Description Type
attributeSeparator If comma seperated attributes won't do, provides an alternate delimiter string for the attributes attribute. Default is ",". String
attributes A (generally) comma seperated list of attributes to return in the search results. Default is null which means return all. String
bindings Whether or not to return bound objects. Set to null or null, default is null. String
context A literal instance of type javax.naming.Context to be used. String
contextRef Attribute name that will be searched for to provide the context. String
countLimit 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). String
derefLink Determines whether links will be dereferenced during the search. Set to null or null, default is null. String
filter* The LDAP-style search filter to use. String
id* Attribute name of the SearchResult to be exported. String
name The name to preform the lookup against. String
nameObject 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. String
scope The scope the object is to be exported as. Default is 'page'. Follows the JSP spec conventions. String
searchScope 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). String
timeLimit The time limit in ms to wait. 0 means wait indefinatly. String

<jndi: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. null

Can contain: JSP

Attributes

Name Description Type
authoritative Provides the value of the Context.AUTHORITATIVE attribute to the InitialContext environment Hashtable. String
batchsize Provides the value of the Context.BATCHSIZE attribute to the InitialContext environment Hashtable. String
dnsUrl Provides the value of the Context.DNS_URL attribute to the InitialContext environment Hashtable. String
env Same as envRef, except that the value is of type java.util.Hashtable. String
envRef 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. String
id* 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) String
initialFactory Provides the value of the Context.INITIAL_CONTEXT_FACTORY attribute to the InitialContext environment Hashtable. String
objectFactories Provides the value of the Context.OBJECT_FACTORIES attribute to the InitialContext environment Hashtable. String
providerUrl Provides the value of the Context.PROVIDER_URL attribute to the InitialContext environment Hashtable. String
scope The scope the object is to be exported as. Default is 'page'. Follows the JSP spec conventions. String
stateFactories Provides the value of the Context.STATE_FACTORIES attribute to the InitialContext environment Hashtable. String
url 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. String
urlPkgPrefixes Provides the value of the Context.URL_PKG_PREFIXES attribute to the InitialContext environment Hashtable. String

<jndi: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.

Can contain: JSP

Attributes

Name Description Type
authoritative Provides the value of the Context.AUTHORITATIVE attribute to the InitialContext environment Hashtable. String
batchsize Provides the value of the Context.BATCHSIZE attribute to the InitialContext environment Hashtable. String
dnsUrl Provides the value of the Context.DNS_URL attribute to the InitialContext environment Hashtable. String
env Same as envRef, except that the value is of type java.util.Hashtable. String
envRef 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. String
id* 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) String
initialFactory Provides the value of the Context.INITIAL_CONTEXT_FACTORY attribute to the InitialContext environment Hashtable. String
objectFactories Provides the value of the Context.OBJECT_FACTORIES attribute to the InitialContext environment Hashtable. String
providerUrl Provides the value of the Context.PROVIDER_URL attribute to the InitialContext environment Hashtable. String
scope The scope the object is to be exported as. Default is 'page'. Follows the JSP spec conventions. String
stateFactories Provides the value of the Context.STATE_FACTORIES attribute to the InitialContext environment Hashtable. String
url 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. String
urlPkgPrefixes Provides the value of the Context.URL_PKG_PREFIXES attribute to the InitialContext environment Hashtable. String