I am working on a project with java servlets and JSP.
I have a java class that generates me a list of products, of type List<Product>
and I saved the list in variable Products.
Ex: List<Product> products = ProductIO.selectProducts();
To access the name description of each list I use. (print them to screen)
System.out.println(products.get(i).getDescription());
Okay! Now here comes the problem, I want to generate a table and place all items descriptions in there, However I get a blank table and I assume is bad syntax.
Here is my products.jsp
code.
<!DOCTYPE html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<meta charset="utf-8">
<title>Murach's Java Servlets and JSP</title>
<link rel="stylesheet" href="styles/main.css" type="text/css"/>
</head>
<body>
<h1>CD list</h1>
<table>
<tr>
<th>Description</th>
<th> </th>
</tr>
<c:forEach var="product" items="${products}" varStatus ="i">
<tr>
<td><c:out value='${product.get(i).getDescription}' /></td>
</tr>
</c:forEach>
</table>
</body>
</html>