user525146
user525146

Reputation: 3998

portlet session variable not retrieved until after two page refreshes

In my controller in serveResource method I am setting an attribute to the PortletSession variable.

PortletSession session = request.getPortletSession();
session.removeAttribute("Letters");
session.setAttribute("Letters", "0");

I am trying to retrieve that value in the JSP page and somehow I don't get it immediately after I load the page. After refreshing the page again then I get the value.

<%=portletSession.getAttribute("Letters") %>

Upvotes: 0

Views: 1441

Answers (1)

Apps
Apps

Reputation: 3389

I think this is the expected behavior. Usually serveResource() method will be invoked as part of an AJAX call. Your whole page doesn't gets refreshed when serveResource() method is called. So even if session contains the updated value, you are not able to see the change since the whole portlet JSP is not processed again at the server end.

Upvotes: 1

Related Questions