Preciso de ajudar urgente. Meus dados da lista de produtos não estão carregando no html. Qual é meu erro?
Minha classe controller:
Product product = new Product();
product.setName("Tagima guitar Baby Mahogany");
product.setDescription("Electro acoustic steel guitar");
product.setUrl("https://www.gubisom.com.br/violao-tagima-baby-mahogany-eletro-acustico-cordas-de-aco");
List<Product> products = Arrays.asList(product);
model.addAttribute("products", products);
return "home";``
Minha classe de produto:
public class Product {
private String name;
private BigDecimal price;
private LocalDate delivery;
private String url;
private String description;
// @Deprecated public Product() { }
public Product(String name, BigDecimal price, LocalDate delivery, String url, String description) {
this.name = name;
this.price = price;
this.delivery = delivery;
this.url = url;
this.description = description;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public LocalDate getDelivery() {
return delivery;
}
public void setDelivery(LocalDate delivery) {
this.delivery = delivery;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
Meu html:
<div th.text="${product.name}">Product name</div>
<div>Price: <span th.text="${product.price}"></span></div>
<div>Delivery date <span th.text="${product.delivery}"></span></div>
<div th.text="${product.name}">Product</div>
<div th.text="${product.url}">
<input type="text" th.value="${product.url}">
</div>
<div>
<textarea cols="30" rows="10" th.text="${product.description}">Description</textarea>
</div>
<div>Order description:</div>
<img th.src="${product.url}" alt="Product image">
</div>
``