Checks whether a Collections contains the specified EJB .

<dsp:containsEJB var-spec



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




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 in Chapter 2.


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


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.


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.


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

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

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

loading table of contents...