Foros de discusión

Get URL of the page by passing portlet ID

thumbnail
Jitendra Rajput, modificado hace 12 años.

Get URL of the page by passing portlet ID

Liferay Master Mensajes: 875 Fecha de incorporación: 7/01/11 Mensajes recientes
Hi All

It is possible that i can get URL or Page of the one portlet inside another portlet?

From my current portlet i pass portlet ID of another portlet and i will get URL for that portlet.

Is it possible ?
if yes then How ?

Thanks in Advance
Jitendra
thumbnail
David H Nebinger, modificado hace 12 años.

RE: Get URL of the page by passing portlet ID

Liferay Legend Mensajes: 14914 Fecha de incorporación: 2/09/06 Mensajes recientes
Anything that you could do along these lines would break under the following scenarios:

* User deletes one of the two portlets from the page because they don't think they need it.
* User adds a copy of the portlet on that page or on other pages.

Instead you'd want to go with the JSR-268 interportlet communication. Your first portlet would publish a message indicating that something happened. Your other portlet subscribes and processes these messages when they arrive. That way if you have zero subscribers, it still works, and if you have multiple subscribers, each of them will still work.
thumbnail
Sagar A Vyas, modificado hace 12 años.

RE: Get URL of the page by passing portlet ID

Liferay Master Mensajes: 679 Fecha de incorporación: 17/04/09 Mensajes recientes
Hi Jitendra,

Yes defiantly you can do this.

Ex.
HttpServletRequest request = PortalUtil.getHttpServletRequest(portletRequest);
PortletURL portletURL = PortletURLFactoryUtil.create(request,portletId, themeDisplay.getPlid(),PortletRequest.RENDER_PHASE);

Here portlet id is something like "xyz_war_xyz."

Thanks,
Sagar Vyas
thumbnail
Jitendra Rajput, modificado hace 12 años.

RE: Get URL of the page by passing portlet ID

Liferay Master Mensajes: 875 Fecha de incorporación: 7/01/11 Mensajes recientes
Thanks Sagar ....It will defiantly help me ..emoticon
thumbnail
Jitendra Rajput, modificado hace 12 años.

RE: Get URL of the page by passing portlet ID

Liferay Master Mensajes: 875 Fecha de incorporación: 7/01/11 Mensajes recientes
Hey Sagar ,
There is one correction if we use your way ..like we need to retrieve page/layoutId.


long plid = PortalUtil.getPlidFromPortletId(themeDisplay.getScopeGroupId(), portletID);
PortletURL portletURL = PortletURLFactoryUtil.create(request, portletID, plid, PortletRequest.RENDER_PHASE);


If we do not pass this plid of another portlet then it will give you URL of current portlet..
thumbnail
Sagar A Vyas, modificado hace 12 años.

RE: Get URL of the page by passing portlet ID

Liferay Master Mensajes: 679 Fecha de incorporación: 17/04/09 Mensajes recientes
Jitendra Rajput:
Hey Sagar ,
There is one correction if we use your way ..like we need to retrieve page/layoutId.


long plid = PortalUtil.getPlidFromPortletId(themeDisplay.getScopeGroupId(), portletID);
PortletURL portletURL = PortletURLFactoryUtil.create(request, portletID, plid, PortletRequest.RENDER_PHASE);


If we do not pass this plid of another portlet then it will give you URL of current portlet..



No plid dont have relation with portlet.so it wont affect at all.

plid: referenced page layout id
portletName: referenced portlet name

Thanks,
Sagar
thumbnail
Sagar A Vyas, modificado hace 12 años.

RE: Get URL of the page by passing portlet ID

Liferay Master Mensajes: 679 Fecha de incorporación: 17/04/09 Mensajes recientes
Jitendra Rajput:
Hi All

It is possible that i can get URL or Page of the one portlet inside another portlet?

From my current portlet i pass portlet ID of another portlet and i will get URL for that portlet.

Is it possible ?
if yes then How ?

Thanks in Advance
Jitendra


If you want create URL from jsp you can simply use as below.

<liferay-portlet:renderURL plid="13605" portletName="mynews_WAR_myresourcesportlet" var="prueba">

<liferay-portlet:param name="resourcePrimKey" value="123456" />

</liferay-portlet:renderURL>

Thanks,
Sagar