Friday, August 6, 2010

Inter Portlet Communication (IPC) for Portlets on Different Page

Use the below code for Inter Portlet Communication (IPC) for Portlets on Different Page:-

String plidName = "Sample_WAR_Sampleportlet";
long plidForward = getPortletId(plidName);
PortletURL url = new PortletURLImpl(request,plidName, plidForward, PortletRequest.ACTION_PHASE);

---------------------------------------------------------------------------------

public static long getPortletId(String portletId) {

PortletPreferences prfs = null;
try {
DetachedCriteria dCriteria = DetachedCriteria
.forClass(PortletPreferences.class);
dCriteria.add(Restrictions.eq("portletId", portletId));
DynamicQuery dynamicQuery = new DynamicQueryImpl(dCriteria);

List list = PortletPreferencesLocalServiceUtil.dynamicQuery(dynamicQuery);

if (!list.isEmpty()) {
prfs = (PortletPreferences) list.get(0);
}

} catch (Exception e) {
e.printStackTrace();
}
return prfs.getPlid();
}

1 comment :

Anonymous said...

How can I connect my one portlet data to another portlet?

It means I have created PIM portlet, Admin portlet, Recruitment Portlet, Timesheet Portlet.

Now I want to interconnect all these portlets. How is it possible.

Because my PIM data comes from Admin portlet.

How??
Can You please help me??

I am using Liferay 6.2.0, with struts2 + Spring3 + Hibernate technology.

I am not using Service Builder.

Thanks in advance...