Checks whether a Collections contains the specified EJB.

<dsp:containsEJB var-spec
   values="collection"
   ejb="search-ejb"
/>

Attributes

var-spec

An EL variable or scripting variable that captures the Boolean result of the operation, defined with one of these attributes:

Attribute

Description

var

Names an EL variable. When you use var, you can set its scope attribute to page, request, session, or application. The default scope is page. For more information, see EL Variable Scopes.

id

Names a scripting variable that scriptlets and expressions can access at runtime.

values

Specifies the Collection to search for the specified EJB. This attribute can specify items of the following data types: array, Enumeration, Iterator, Collection, and Map. If values is set to Map, the Map’s key is compared.

ejb

Identifies the EJB to find in the Collection.

Usage Notes

EJB comparison operations require their own tag because two EJB instances might appear identical but have different addresses, and so fail a comparison that should otherwise pass. dsp:containsEJB only compares object primary keys and ignores object addresses.

Example

<dsp:getvalueof bean="Student_01" var="student">

<dsp:containsEJB var="seniorReminder" values="${student.class}" ejb="senior"/>
   <c:choose>
       <c:when test="${seniorReminder}">
           Don't forget to order your cap and gown!
       </c:when>
   </c:choose>
</dsp:getvalueof>

In this example, the dsp:containsEJB tag determines whether senior is an EJB in Student_01.class. If so, the specified message displays.