Description
Ingo Marahrens opened SPR-6071 and commented
In the ACTION or EVENT phase of the portlet the handler method can request to get an implicit model by defining a Model parameter in the methods signature (e.g. public void action(ActionResponse response, Model model) { //do something e.g. modeel.AddAttribute("modelData", new Object()); }).
If the type hase declared the @SessionAttributes
("modelData") annotation, the contents of this implicit model object are populated into the portlet session.
The method handler in the render phase can also request an implicit model object (same as the action handler), but this object is newly created prior to the methods invocation and as a result completely empty.
Therefore the method model.containsAttribute("modelData") does not make much sense, because usually the model is empty.
To get the data stored in the model of the ACTION or EVENT phase, it is necessary to check the session and copy the objects to the model to be accessed from the jsp.
It would be much more convient, if the implicit model in the render phase is populated with the session data before the render phase handler method is executed.
Affects: 3.0 M4
Issue Links:
- @SessionAttributes to be exposed in model even when not referenced in current handler method [SPR-6084] #10752
@SessionAttributes
to be exposed in model even when not referenced in current handler method