0

I'm trying to display the errors of a spring form with a redirection on the form page but nothing. But the errors appear when I do return formpage. However this method does not display the data of the select fields

if (!result.hasErrors()) {
    cylindreService.createCylindre(cylindre);
    redirectAttrs.addFlashAttribute(
                            "success",
                            "Cylindre " + cylindre.getNumgma() + " à été ajouté avec succès"
    );
    return "redirect:/cylindre/listes";
}
return "redirect:/cylindre/add";
Andrew Regan
  • 5,087
  • 6
  • 37
  • 73
  • 1
    The errors don't survive the redirect. So either don't redirect on errors or handle as for success: https://stackoverflow.com/questions/2543797/spring-redirect-after-post-even-with-validation-errors – Alan Hay Sep 20 '19 at 14:50
  • 1
    Possible duplicate of [Spring - Redirect after POST (even with validation errors)](https://stackoverflow.com/questions/2543797/spring-redirect-after-post-even-with-validation-errors) – Alan Hay Sep 20 '19 at 14:50

0 Answers0