79367519

Date: 2025-01-18 16:33:20
Score: 2
Natty:
Report link

I found the issue: the message did not show properly because I used add attribute, and I should use addFlashAttribute.

It does not work with:

    redirectAttributes.addAttribute("msg", msg);

It works with:

   redirectAttributes.addFlashAttribute("msg", msg);

Based on this explanation, my understanding is that it makes sense to use FlashAttribute after a modal window, because FlashAttribute uses a map stored in the session, which would be updated after I close my modal, vs. addAttribute, which would need to reload the original page.

If this understanding is not correct, I will be grateful if someone can explain why in my case FlashAttribute works and not Attribute.

Reasons:
  • RegEx Blacklisted phrase (2): I will be grateful
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Guillaume