Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
spring-projects-issues opened this issue Sep 2, 2009 · 1 comment
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Sep 2, 2009

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:

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Good point! As of 3.0 RC1, we expose all @SessionAttributes to the model - independent from whether they have been referenced in the handler method signature - before actually executing the handler method.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants