Skip to content

Instantly share code, notes, and snippets.

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