Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@PostMapping(value = "/agregar")
@ResponseBody
public String guardarProducto(@ModelAttribute Producto producto, RedirectAttributes redirectAttrs) {
productosRepository.save(producto);
redirectAttrs
.addFlashAttribute("mensaje", "Agregado correctamente")
.addFlashAttribute("clase", "success");
return "redirect:/productos/agregar";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment