Integrate RedirectAttributes with ModelMap [SPR-9418] #14054
Labels
status: declined
A suggestion or change that we don't feel we should currently apply
type: enhancement
A general enhancement
marc schipperheyn opened SPR-9418 and commented
I have been playing around with RedirectAttributes and although I like the FlashAttribute function, I don't really like the way it has been implemented.
For me, FlashAttributes come into play in the GET/POST/Redirect/displayStatus chain. What I don't like is that FlashAttributes aren't a transparent part of the ModelMap but instead separated through RedirectAttributes. I would prefer to say
model.addFlashAttribute(...) in stead of having the specify RedirectAttributes separately redirectAttributes.addFlashAttribute(...).
Also, when I add a FlashAttribute to a Model/RedirectAttributes and I don't redirect, I expect the FlashAttribute to be treated as a normal model attribute. and because they are separate, it isn't.
In the flow of a Controller, whether one redirects often depends on the context. And because RedirectAttributes are separate from ModelAttributes (when they are conceptually the same), I find myself having to duplicate certain actions, which is exactly what I want to avoid.
What I would expect is to have a single action against the ModelMap
model.addFlashAttribute(...)
if the controller redirects, it is treated as a flash attribute
if the controller doesn't redirect, it treated as a model attribute
No further details from SPR-9418
The text was updated successfully, but these errors were encountered: