How can I find which portlets are added on a particular Liferay page?
For Example:
I have three pages: Welcome, Wiki and Search.
Now all these pages have portlets added on them and some of them are instanceable portlets (like web-content display and iframe portlets).
Now I want to pass some information in the form of request parameters to the iframe-portlet
on the Search page
from the Welcome page
.
I have found two ways to do this:
If you want to find the portlets on the same page in which your portlet is added then, you can make use of
themeDisplay
object available to your portlet or JSP:If you want to find the portlets on some different page, then you should know three things viz;
friendly-url
,groupId
and whether this page is apublic-page
orprivate-page
of the Site (or Community), so here is the code:The
portletIdList
contains the portletIds complete with their instanceIds. So now from the list you can just filter out theiframe-portlet
on the/search
page by usingcom.liferay.portal.util.PortletKeys.IFRAME
and you will get something like48_INSTANCE_rPv9
.