Skip to content

Instantly share code, notes, and snippets.

@netodevel
Created December 30, 2016 19:08
Show Gist options
  • Save netodevel/6d09a235e0d3894501e083a348543eba to your computer and use it in GitHub Desktop.
Save netodevel/6d09a235e0d3894501e083a348543eba to your computer and use it in GitHub Desktop.
@PostMapping("/salarios")
public String save(@Valid @ModelAttribute("salarioMinimo") SalarioMinimo salarioMinimo, BindingResult bindingResult, RedirectAttributes redirectAttributes) {
try {
salarioMinimoService.save(salarioMinimo);
redirectAttributes.addFlashAttribute("sucesso", "Salário salvo com sucesso.");
} catch (Exception e) {
e.printStackTrace();
redirectAttributes.addFlashAttribute("error", "Problema ao salvar salário.");
}
return "redirect:/salarios/novo";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment