Skip to content

Fill implicit model with session-backed data for portlets render phase [SPR-6071] #10739

Closed
@spring-projects-issues

Description

@spring-projects-issues

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:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions