How can I return a view dynamically by means of a controller in spring boot
This is my index.html
<html>
<head>
<title>prueba</title>
</head>
<body>
<div th:replace="${contenido}"></div>
</body>
</html>
This is my page1.html
<div>
pagina 1
</div>
This is my page2.html
<div>
pagina 2
</div>
These are my controllers
@GetMapping("/")
public String showIndex(Model model) {
model.addAttribute("contenido", "pagina1");
return "index";
}
@GetMapping("/prueba")
public String showIndex(Model model) {
model.addAttribute("contenido", "pagina2");
return "index";
}
It does not work for me in which it will be that it is failing