Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Jitendra Rajput
Get URL of the page by passing portlet ID
30 de mayo de 2011 23:51
Respuesta

Jitendra Rajput

Ranking: Liferay Master

Mensajes: 709

Fecha de incorporación: 7 de enero de 2011

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
David H Nebinger
RE: Get URL of the page by passing portlet ID
31 de mayo de 2011 12:31
Respuesta

David H Nebinger

Ranking: Liferay Legend

Mensajes: 7010

Fecha de incorporación: 1 de septiembre de 2006

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.
Sagar A Vyas
RE: Get URL of the page by passing portlet ID
3 de agosto de 2011 2:01
Respuesta

Sagar A Vyas

Ranking: Liferay Master

Mensajes: 655

Fecha de incorporación: 17 de abril de 2009

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
Jitendra Rajput
RE: Get URL of the page by passing portlet ID
3 de agosto de 2011 2:22
Respuesta

Jitendra Rajput

Ranking: Liferay Master

Mensajes: 709

Fecha de incorporación: 7 de enero de 2011

Mensajes recientes

Thanks Sagar ....It will defiantly help me ..emoticon
Jitendra Rajput
RE: Get URL of the page by passing portlet ID
3 de agosto de 2011 3:54
Respuesta

Jitendra Rajput

Ranking: Liferay Master

Mensajes: 709

Fecha de incorporación: 7 de enero de 2011

Mensajes recientes

Hey Sagar ,
There is one correction if we use your way ..like we need to retrieve page/layoutId.

1
2long plid = PortalUtil.getPlidFromPortletId(themeDisplay.getScopeGroupId(), portletID);
3PortletURL 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..
Sagar A Vyas
RE: Get URL of the page by passing portlet ID
3 de agosto de 2011 13:32
Respuesta

Sagar A Vyas

Ranking: Liferay Master

Mensajes: 655

Fecha de incorporación: 17 de abril de 2009

Mensajes recientes

Jitendra Rajput:
Hey Sagar ,
There is one correction if we use your way ..like we need to retrieve page/layoutId.

1
2long plid = PortalUtil.getPlidFromPortletId(themeDisplay.getScopeGroupId(), portletID);
3PortletURL 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
Sagar A Vyas
RE: Get URL of the page by passing portlet ID
3 de agosto de 2011 13:35
Respuesta

Sagar A Vyas

Ranking: Liferay Master

Mensajes: 655

Fecha de incorporación: 17 de abril de 2009

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