The productList model is not passed to the products.html page. What could be causing this? There is a dependency in the pom file, and it is also written on the html page
ProductController.class
@Controller
public class ProductController {
@Autowired
private ProductService productService;
@GetMapping("/allProducts")
public String products(Model model){
List<Product> productList = productService.getAllProducts();
model.addAttribute("productList", productList);
return "products";
}
}
product.html
<!DOCTYPE html>
<html lang="en">
<html xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
<meta charset="UTF-8">
<title>eshop</title>
</head>
<body>
<h1>E-SHOP</h1><hr>
<table>
<tr>
<th>Title</th>
<th>Description</th>
<th>price</th>
<th>City</th>
<th>Author</th>
</tr>
<tr th:each="param : ${productList}">
</tr>
</table>
</body>
</html>
