I try to write custom tag <shop:products col="xxx"> that should output products into some columns (col="2" -> two columns)

So how can I do it?

I got a class ShopModel with function
Java Code:
List<PkshopProduct> findProductsByCategory(Integer category)
that returns list of products. Next I have to insert that data into my tag-file.


Question 1) Should I use scriplet like this

XML Code:
<% List<PkshopProduct> products = catalog.findProductsByCategory(1);%>
Or there is some other neat way?


Question 2) How can I organize <c:forEach to do this

XML Code:
<table>
  <c:forEach items="products" var="product">
    <c:if test="${i % col == 0 }"><tr></c:if>
      <td>
         _OUTPUT_DATA_FROM_ products 
      </td>
    <c:if test="${i % col == 0 }"></tr></c:if>
  </c:forEach>
</table>