JNDI taglib ver. 1.4

    Custom JSP taglib. Lets you perform basic JNDI operations.

For example:
 


<%@ taglib uri="taglib.tld" prefix="jndi" %>

<jndi:Context id="ctx">
  <jndi:setProperty name="java.naming.factory.initial"> com.evermind.server.ApplicationClientInitialContextFactory </jndi:setProperty>
  <jndi:setProperty name="java.naming.security.principal">admin</jndi:setProperty>
</jndi:Context>

<jndi:lookup contextId="ctx" id="factory" name="java:comp/env/jms/theTopicConnectionFactory"/>

Some components from Coldtags suite (like JMS and EJB taglibs) use this taglib.

Tags are:

Context

Body tag. Obtains an initial context and saves obtained value in the page scope variable. Body (could be empty) lets you define environment (see setProperty tag). Parameters are:

1) id Describes a name for the variable with the obtained context
2) scope Optional parameter. Possible values are page, request, session or application. Defines a scope for your variable. Default value is page.

setProperty

Body tag you may use within Context tag. Body defines a property for your environment. Parameters are:

1) name name for the property

lookup

Retrieves the named object and saves obtained value. In case of errors tag sets saved value to null. Parameters are:

1) contextId Defines a name for context variable
2) contextScope Optional parameter. Possible values are page, request, session or application. Defines a scope for your context variable. Default value is page.
3) id Describes a variable name for the retrieved object
4) scope Optional parameter. Possible values are page, request, session or application. Defines a scope for the retrieved object. Default value is page.
5) name the name of the object to look up

lookupSuccess

Body tag. Retrieves the named object and saves obtained value. In case of errors tag sets saved value to null and skips body. Otherwise body will be executed. Parameters are:

1) contextId Defines a name for context variable
2) contextScope Optional parameter. Possible values are page, request, session or application. Defines a scope for context variable. Default value is page.
3) id Describes a variable name for the retrieved object
4) scope Optional parameter. Possible values are page, request, session or application. Defines a scope for the retrieved object. Default value is page.
5) name Describes a name of the object to look up

lookupFailure

Body tag. Retrieves the named object and saves obtained value. In case of errors tag sets saved value to null and executes body. Otherwise (no errors) body will be skipped. Parameters are:

1) contextId Defines a name for context variable
2) contextScope Optional parameter. Possible values are page, request, session or application. Defines a scope for context variable. Default value is page.
3) id Describes a variable name for the retrieved object
4) scope Optional parameter. Possible values are page, request, session or application. Defines a scope for the retrieved object. Default value is page.
5) name Describes a name of the object to look up

forEachBinding

Body tag. Executes own body for each binding in the given context. Within tag's body you may use nested variables currentName, currentClass and currentObject as a reference to the current element. Parameters are:

1) contextId Defines a name for context variable
2) contextScope Optional parameter. Possible values are page, request, session or application. Defines a scope for context variable. Default value is page.

for downloading:

Library: jnditag.jar    Description: taglib.tld

© Coldbeans      Comments?

See also Coldtags suite - the largest collection of custom JSP tags.

Also in Coldtags: