title: <c:if test = "${product.categoryid}==${loop1.index+1}"> does not seem to work
body: <p>I have two array lists, a category and a product array list, in my servlet</p>
  <pre><code>@WebServlet(urlPatterns = &quot;/homepage.do&quot;)
  public class HomePageServlet extends HttpServlet {
      Category category = new Category(0, null, null);
      CategoryDAO cd = new CategoryDAOImpl();
      
      Product product = new Product(0, null, null, null);
      ProductDAO pd = new ProductDAOImpl();
      
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
                  
          List&lt;Category&gt; categories = cd.selectAllCategory();
          request.setAttribute(&quot;categories&quot;, categories);
          System.out.println(categories);
          
          List&lt;Product&gt; products = pd.selectAllProducts();
          request.setAttribute(&quot;products&quot;, products);
          System.out.println(products);
          
              request.getRequestDispatcher(&quot;/WEB-INF/views/homepage.jsp&quot;).forward(request, response);
              
      
      }
  
  }
  </code></pre>
  <p>And the JSP file</p>
  <pre><code>    &lt;c:forEach items=&quot;${categories}&quot; var=&quot;category&quot; varStatus=&quot;loop1&quot;&gt;
      &lt;div class=&quot;category-block&quot; id =&quot;${loop1.index+1}&quot;&gt;
          &lt;h2 class = &quot;category-title&quot;&gt;${category.name } &lt;/h2&gt;
          &lt;a href=&quot;#&quot;&gt;Read description&lt;/a&gt;&lt;br&gt;
          &lt;a href=&quot;/delete-category.do?categoryid=${loop1.index+1}&quot; class=&quot;btn btn-danger&quot;&gt;Delete ${category.name} category&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
          &lt;a href=&quot;/edit-category.do?categoryid=${loop1.index+1}&quot; class=&quot;btn btn-warning&quot;&gt;Edit ${category.name} category&lt;/a&gt;&lt;br&gt;&lt;br&gt;
         
          &lt;div class=&quot;row &quot;&gt;
              &lt;c:forEach items=&quot;${products}&quot; var=&quot;product&quot; varStatus=&quot;loop2&quot;&gt;
              &lt;c:if test = &quot;${product.categoryid}==${loop1.index+1}&quot;&gt;
                  &lt;div class=&quot;col-sm-3&quot;&gt;
                      &lt;div class=&quot;card border w-60 text-center&quot;id =&quot;${loop2.index}&quot; &gt;
                          &lt;img class=&quot;card-img&quot; src=&quot;&quot; alt=&quot;some image&quot;&gt;${product.image }
                          &lt;p id=&quot;${loop2.index}&quot; class=&quot;card-title&quot;&gt;${product.name}&lt;/p&gt;
                          &lt;p class=&quot;card-text&quot;&gt;${product.description }&lt;/p&gt;
                          &lt;a href =&quot;/edit-product.do?categoryid=${loop1.index+1}&amp;productid=${loop2.index+1}&quot; class=&quot;btn btn-success&quot;&gt;Edit&lt;/a&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
                          &lt;a href =&quot;/delete-product.do?name=${product.name}&amp;productid=${loop2.index}&quot; class=&quot;btn btn-danger&quot;&gt;Delete&lt;/a&gt;
                          
                      &lt;/div&gt;
                     &lt;/div&gt;
                 &lt;/c:if&gt;
              &lt;/c:forEach&gt;
          &lt;/div&gt;  
          &lt;a href=&quot;/add-product.do?categoryid=${loop1.index+1}&quot; class=&quot;btn btn-primary&quot;&gt;Add    Product&lt;/a&gt;
      &lt;/div&gt;
   &lt;/c:forEach&gt;
  </code></pre>
  <p>I want that whenever the id of the first loop (loop1.index+1) matches the product.categoryid, that product(with that categoryid) should display.</p>
  <p>Without the if taglib, the products display in all the categories irrespective of the id. With the if tag however, no product displays because the first product has categoryid = 2.</p>
  <p>The aim of the display is that, for each number of the first loop (loop1.index+1), each product should be checked to see if its product.categoryid == loop (loop1.index+1). This is done for all the product and those with a true condition are printed, and then the first loop goes on for the next id.
  Please, any help?</p>