+--------+-------+-----+
| Name |number |qty |
+--------+-------+-----+
| ab | 5 | 7 |
+--------+-------+-----+
| cd | 1 | 6 |
+--------+-------+
Make your search()
method return a List<Product>
instead of a single Product
.
public List<Product> search(){
List<Product> products = new ArrayList<Product>();
ResultSet rs = DAO.fetch("SELECT * FROM Products");
while (rs.next()) {
Product product = new Product();
product.setNumber(rs.getString("ProductNumber"));
product.setName(rs.getString("ProductName"));
product.setQty(rs.getString("ProductQty"));
products.add(product);
}
return products;
}
Then, in your JSP file, iterate over the returned list:
<c:forEach var="product" items="${products}">
<!-- build your row -->
</c:forEach>