Portlets communication on the same page in render phase.
Once again I faced the same old problem: I have one portlet A which carries a value X and 2 other portlets on the same page B and C that needs this value X on their render phase. The problem exists, because also the portlet A has this value on its render phase. So, how can you transfer the value X from the render phase of the portlet A to the render phases of the portlets B and C?
According to this wiki article we cannot use the IPC methods because we have no action phase on portlet A. So, only two options remain:
- portlet session
According to the documentation in the DTD (liferay 6.1):
The default value of render-weight is 1. If set to a value less than 1, the portlet is rendered in parallel. If set to a value of 1 or greater, then the portlet is rendered serially. Portlets with a greater render weight have greater priority and will be rendered before portlets with a lower render weight. If the ajaxable value is set to false, then render-weight is always set to 1 if it is set to a value less than 1. This means ajaxable can override render-weight if ajaxable is set to false.
So, setting those element value to 3 for portlet A and to 2 for the portlets B and C will ensure that A will execute its render method before the other two portlets.