You see, I am working with spring and thymeleaf and I am just a beginner in this subject; I have the following tree which contains some modules and beside it is a form with which you can create and edit the modules.
my problem is that when I want to edit a module I want to fill in the fields of the form when I click on one of the elements of
tree
; I have the following ajax
with which I sent my controller
the id of the module to perform the search in the database:
function rellenarModulo() {
$.ajax({
type: "POST",
url: "/creadorRellenar",
data: {
idModulo: idNodo
},
success: function(data) {}
});
}
and in my controller the following:
@RequestMapping(value = "/creadorRellenar", method = RequestMethod.POST)
public String getModulo(@ModelAttribute Modulo mod, Model model) {
int idModuloSeleccionado = mod.getIdModulo();
Modulo modulo = adminService.getModuloById(idModuloSeleccionado).get(0);
System.out.println(modulo.getNombreModulo()+"
"+modulo.getDescripcionModulo());
model.addAttribute("moduloss",modulo);
return "creador";
}
The data is sent correctly to the view; but nevertheless they do not show on the screen; I could only check it in the following way: