title: How can I check if a collection contains an item using JSP/EL/JSTL
body: <p>I am using Java 8, Tomcat 8, with Servlet 3.1.0, JSP 2.0 and JSTL 1.2.</p>
  
  <p>I expected to be able to do the following. However, it does not work.</p>
  
  <pre><code>&lt;c:forEach var="item" items="${itemList}" varStatus="status"&gt;
    &lt;tr&gt;
      &lt;td&gt;${status.index + 1}&lt;/td&gt;
      &lt;td&gt;${item.itemCode}&lt;/td&gt;
      &lt;td&gt;${item.displayName}&lt;/td&gt;
      &lt;td&gt;
        &lt;c:choose&gt;
          &lt;c:when test="${user.favourites.contains(item)}"&gt;Yes&lt;/c:when&gt;
          &lt;c:otherwise&gt;No&lt;/c:otherwise&gt;
        &lt;/c:choose&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/c:forEach&gt;
  </code></pre>
  
  <p>where <code>user.favourites</code> is a <code>Set</code> of <code>item</code>s</p>
  
  <p>Could it be that I do not have the right versions of the dependencies. My POM contains;</p>
  
  <pre><code>  &lt;dependency&gt;
     &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
     &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
     &lt;version&gt;3.1.0&lt;/version&gt;
     &lt;scope&gt;provided&lt;/scope&gt;
    &lt;/dependency&gt;
  
    &lt;dependency&gt;
     &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
     &lt;artifactId&gt;jsp-api&lt;/artifactId&gt;
     &lt;version&gt;2.0&lt;/version&gt;
     &lt;scope&gt;provided&lt;/scope&gt;
    &lt;/dependency&gt;
  
    &lt;dependency&gt;
     &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
     &lt;artifactId&gt;jstl&lt;/artifactId&gt;
     &lt;version&gt;1.2&lt;/version&gt;
    &lt;/dependency&gt;
  </code></pre>
  
  <p><code>servlet-api</code> and <code>jsp-api</code> are provided by Tomcat. Is the version for <code>jstl</code> correct?</p>