Liferay: Is it possible to determine portlet initialization dependency?

I have two portlets: portlet-a and portlet-B.

Portlet-A does some initialization of the data and stores it in a common area.

Portlet-B during initialization requires this data (from portlet-A) from a common area.

However, I need to determine that Portlet-A must be started (rendered) before portlet-B.

Is it possible for Liferay to define some initialization order or something like a portlet dependency?

+4
source share
2 answers

If I understood correctly, you need portlet-A to appear in front of portlet-B on the same page.

You can then define this in liferay-portlet.xml : <render-weight>50</render-weight> , the larger the render-weight , the faster the portlet will display, or in other words, if the render-weight portlet-B is less, than Portlet-A, then it will be displayed after Portlet-A.

More explanations regarding render-weight in DTD

Hope this helps.

+4
source

To my knowledge, Liferay does lazy loading for portlets, so you cannot guarantee the portlet initialization order, as well as the call.

The problem you are facing is a common problem when you are working with multiple portlets on the same page.

Here the general way is that the configuration portlet (in your case portfolio A) should set the property in the processAction() method, and the getter portlet (portlet B) should take the value from doView() .

The reason is that you cannot guarantee the order of doView() , but if you shoot in actionURL, processAction() always called before doView ().

Thus, the attribute will be available for the rest of the portlet when rendering the interface. Guaranteed!

+3
source

All Articles