bonjour;

je fait charger un table en thymeleaf par une methode de class controller mais toujours le table est vide et voiçi le code de classe controller et le fichier html :

classe controller :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 
import java.util.List;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
 
import com.praogramme.test.domain.Produit;
import com.praogramme.test.service.ProduitManager;
 
@Controller
 
public class ProduitController {
	@Autowired
	ProduitManager manager;
 
	protected String page = "my";
 
 
 
 
 
 
    @RequestMapping(value = "message", method = RequestMethod.GET)
    public String messages(Model model) {
        model.addAttribute("messages",manager.listeDeProduits());
        return "my";
    }
 
}
------------------------
le fichier my.html


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<html lang="en"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
 
<head>
    <title>Home</title>
</head>
<body>
 
 
<table class="table table-striped">
             <thead>
			<tr>
				<th>ID</th>
				<th>Description</th>
				<th>Prix</th>
 
			</tr>
		</thead>
 
      <tbody>  
      <tr th:each="contact : ${message}">  
        <td th:text="${contact.idProduit}"></td>  
        <td th:text="${contact.Desciption}"></td>  
        <td th:text="${contact.prix}"></td>
    </tr>  
    </tbody>
</table>
</body>
</html>
--------------------------

je vais que quelqu'un m'aide pour ce code ou me donne un exemple bien détailler;

et merci.