Hi,
Sometimes, we need to get preferences of a portlet into another portlet and take action appropriately.
Here is a snippet on how to do so. Suppose we have portlets A and B. We need preferences of A in B.
We can use dynamic query to get all the preferences of the portlet. From B we can use the code below. Replace myportletA with the correct porltetId.
We need to convert com.liferay.portal.model.PortletPreferences to javax.portlet.PortletPreferences to use getValue() or getValues() method.
Hope this helps someone.
Cheers!!!
Sometimes, we need to get preferences of a portlet into another portlet and take action appropriately.
Here is a snippet on how to do so. Suppose we have portlets A and B. We need preferences of A in B.
We can use dynamic query to get all the preferences of the portlet. From B we can use the code below. Replace myportletA with the correct porltetId.
We need to convert com.liferay.portal.model.PortletPreferences to javax.portlet.PortletPreferences to use getValue() or getValues() method.
Hope this helps someone.
Cheers!!!
Nice!
ReplyDeleteIt solve my problem.
Thanks!