Hi everyone
I have 2 porlets on a portal page. I would like Portlet A to set an application variable when a link is clicked in the portlet's body. Portlet B must then read this variable and display it. The problem is that Portlet B renders before Portlet A and the variable it displays is consequently always 1 step behind what A set.
The code in Portlet A to set the variable is in the processAction method and looks as follows:
String id = aRequest.getParameter("id"); aResponse.setRenderParameter("id", id); PortletSession ps = aRequest.getPortletSession(); ps.setAttribute("id", id, PortletSession.APPLICATION_SCOPE);
String object_id = (String)request.getSession().getAttribute("id");
Found the problem - was passing the wrong variable value and now it all works fine. So anyway, this is now a little example of how to do IPC with application variables - hope it help someone!