Fórum

Portlet communication

Michele Benson, modificado 12 Anos atrás.

Portlet communication

New Member Postagens: 16 Data de Entrada: 23/03/11 Postagens Recentes
Hi guys,

I want to connect 2 portlet in two different ways:

1) I have two portlet in the same page and i want to send a parameter when clicking somewhere ( link or button ) on my first portlet. I want then read this parameter from the doview of my second portlet. Everithing without refreshing the page.

2) I have two portlet in different pages. I want to send a parameter from the first one to the second one and reading it from the second portlet doview.

I have read a lot of topics and tutorials but i cannot do it. Now i'm doing it using the session and refreshing the page, but it's not very smart.

Thanks,

Michael
thumbnail
jelmer kuperus, modificado 12 Anos atrás.

RE: Portlet communication

Liferay Legend Postagens: 1191 Data de Entrada: 10/03/10 Postagens Recentes
1) use public render parameters : see http://www.ibm.com/developerworks/websphere/library/techarticles/0803_hepper/0803_hepper.html

2)
PortletURL portletURL = new PortletURLImpl(request, [PORTLETID OF THE PORTLET YOU WANT TO LINK TO] , [PLID OF THE PAGE YOU WANT TO LINK TO], PortletRequest.RENDER_PHASE);
portletURL.setParameter("yourparam", yourvalue);


or use public render parameters with the following property in your portal-ext.properties

portlet.public.render.parameter.distribution=layout-set
Michele Benson, modificado 12 Anos atrás.

RE: Portlet communication

New Member Postagens: 16 Data de Entrada: 23/03/11 Postagens Recentes
jelmer kuperus:
1) use public render parameters : see http://www.ibm.com/developerworks/websphere/library/techarticles/0803_hepper/0803_hepper.html


Can you give me an example?

jelmer kuperus:
2)
PortletURL portletURL = new PortletURLImpl(request, [PORTLETID OF THE PORTLET YOU WANT TO LINK TO] , [PLID OF THE PAGE YOU WANT TO LINK TO], PortletRequest.RENDER_PHASE);
portletURL.setParameter("yourparam", yourvalue);


How do i get portlet id and page plid being sure that they are right?


jelmer kuperus:

or use public render parameters with the following property in your portal-ext.properties

portlet.public.render.parameter.distribution=layout-set


What does it means this property?
thumbnail
jelmer kuperus, modificado 12 Anos atrás.

RE: Portlet communication

Liferay Legend Postagens: 1191 Data de Entrada: 10/03/10 Postagens Recentes
Can you give me an example?


I think the portlets in action book has some sample code that illustrates public render parameters : http://code.google.com/p/portletsinaction/downloads/detail?name=src-ch-9to11.zip

Its hardly rocketscience though and you should be able to get by with just the article i linked




How do i get portlet id and page plid being sure that they are right?


the plid is the unique id of a page in liferay. This is one way to get the plid for a page that you access via /yoururl

Layout somelayout = LayoutLocalServiceUtil.getFriendlyURLLayout(assetRenderer.getGroupId(), false, "/yoururl");
long plid = somelayout.getPlid(),


If you use this approach it does mean that if someone changes the url of the page to /something else that your site will break. If you the portlet you are targetting is typically only found on one page in your site you can use this instead

long plid = PortalUtil.getPlidFromPortletId(themeDisplay.getScopeGroupId(), "your portlet id");


That will find the id of the first page in your site that has that portlet.

The porlet id is what you see in the url under the p_p_id parameter when you execute an action in the portlet you are targetting




What does it means this property?


Normally when you set a public render parameter they are only visible to portlets on the same page. When you set that property to layout-set they are also visible to portlets on other pages
Michele Benson, modificado 12 Anos atrás.

RE: Portlet communication

New Member Postagens: 16 Data de Entrada: 23/03/11 Postagens Recentes
Thanks a lot for the answers!! another little question about this code:



Layout somelayout = LayoutLocalServiceUtil.getFriendlyURLLayout(assetRenderer.getGroupId(), false, "/yoururl");
long plid = somelayout.getPlid(),





From where can I get assetRenderer object?
thumbnail
jelmer kuperus, modificado 12 Anos atrás.

RE: Portlet communication

Liferay Legend Postagens: 1191 Data de Entrada: 10/03/10 Postagens Recentes
ehhh that was a typo that should be themeDisplay.getScopeGroupId()
simon tuffle, modificado 12 Anos atrás.

RE: Portlet communication

Regular Member Postagens: 150 Data de Entrada: 18/05/09 Postagens Recentes
Michele Benson:
jelmer kuperus:
1) use public render parameters : see http://www.ibm.com/developerworks/websphere/library/techarticles/0803_hepper/0803_hepper.html


Can you give me an example?

jelmer kuperus:
2)
PortletURL portletURL = new PortletURLImpl(request, [PORTLETID OF THE PORTLET YOU WANT TO LINK TO] , [PLID OF THE PAGE YOU WANT TO LINK TO], PortletRequest.RENDER_PHASE);
portletURL.setParameter("yourparam", yourvalue);


How do i get portlet id and page plid being sure that they are right?


jelmer kuperus:

or use public render parameters with the following property in your portal-ext.properties

portlet.public.render.parameter.distribution=layout-set


What does it means this property?




2) I think we can also get the plid, by observing the liferay database(if you are enough patiency).Have a try on this
ffang0101 ffang0101, modificado 12 Anos atrás.

mbt

New Member Postagens: 2 Data de Entrada: 20/06/11 Postagens Recentes
polo shirts
ralph lauren polo shirts
ralph lauren polos
polo outlet online
ralph lauren jacket
long sleeve polo shirts
Ralph Lauren Stripe Polo
big pony polo shirts
cheap polo shirts
polo shirts for men
ralph lauren outlet

ralph lauren polos
polo shirts
ralph lauren sale
womens polo shirts
mens polo shirts
rugby Ralph Lauren shirts
kids polo shirts
ralph lauren hoodies
ralph lauren uk
cheap ralph lauren
ralph lauren shirts
ffang0101 ffang0101, modificado 12 Anos atrás.

polo

New Member Postagens: 2 Data de Entrada: 20/06/11 Postagens Recentes
<p><a href="http://www.polo-shirt-sale.com"><em><strong><br>
polo shirts</strong></em></a></p>
<p><em><strong><a href="http://www.polo-shirt-sale.com/ralph-lauren-polo-shirts.html">ralph lauren polo shirts</a></strong></em></p>
<p><em><strong><a href="http://www.polo-shirt-sale.com">ralph lauren polos</a></strong></em></p>
<p><em><strong><a href="http://www.polo-shirt-sale.com/polo-outlet-online.html">polo outlet online</a></strong></em></p>
<p><em><strong><a href="http://www.polo-shirt-sale.com/ralph-lauren-men-jackets-c-1.html">ralph lauren jacket</a></strong></em></p>
<p><em><strong><a href="http://www.polo-shirt-sale.com/long-sleeve-lacoste-polos-c-4.html">long sleeve polo shirts</a></strong></em></p>
<p><em><strong><a href="http://www.polo-shirt-sale.com/ralph-lauren-stripe-polo-c-13.html">Ralph Lauren Stripe Polo</a></strong></em></p>
<p><em><strong><a href="http://www.polo-shirt-sale.com/ralph-lauren-big-pony-polo-c-6.html">big pony polo shirts</a></strong></em></p>
<p><em><strong><a href="http://www.polo-shirt-sale.com/cheap-polo-shirts.html">cheap polo shirts</a></strong></em></p>
<p><em><strong><a href="http://www.polo-shirt-sale.com/polo-shirts-for-men.html">polo shirts for men</a></strong></em></p>
<p><em><strong><a href="http://www.polo-shirt-sale.com/ralph-lauren-outlet.html">ralph lauren outlet</a></strong></em></p>


<p><a href="http://www.lacoste-polo-sale.com"><em><strong>ralph lauren polos</strong></em></a></p>
<p><a href="http://www.lacoste-polo-sale.com/polo-shirts.html"><em><strong>polo shirts</strong></em></a></p>
<p><em><strong><a href="http://www.lacoste-polo-sale.com/ralph-lauren-sale.html">ralph lauren sale</a></strong></em></p>
<p><em><strong><a href="http://www.lacoste-polo-sale.com/womens-lacoste-polos-c-16.html">womens polo shirts</a></strong></em></p>
<p><a href="http://www.lacoste-polo-sale.com/mens-rl-mesh-polo-shirts-c-11.html"><strong><em>mens polo shirts</em></strong></a></p>
<p><em><strong><a href="http://www.lacoste-polo-sale.com/long-sleeve-lacoste-polos-c-4.html">rugby Ralph Lauren shirts</a></strong></em></p>
<p><em><strong><a href="http://www.lacoste-polo-sale.com/kidss-rl-polo-shirts-c-18.html">kids polo shirts</a></strong></em></p>
<p><em><strong><a href="http://www.lacoste-polo-sale.com/wemens-rl-zip-hoodies-c-15.html">ralph lauren hoodies</a></strong></em></p>
<p><em><strong><a href="http://www.lacoste-polo-sale.com/ralph-lauren-uk.html">ralph lauren uk</a></strong></em></p>
<p><em><strong><a href="http://www.lacoste-polo-sale.com/cheap-ralph-lauren.html">cheap ralph lauren</a></strong></em></p>
<p><em><strong><a href="http://www.lacoste-polo-sale.com/ralph-lauren-shirts.html">ralph lauren shirts</a></strong></em></p>


<a href="http://www.mbtshoestoreonline.com"><strong>mbt shoes</strong></a>
<a href="http://www.mbtshoestoreonline.com/cheap-mbt-shoes.html"><strong>cheap mbt shoes</strong></a>
<a href="http://www.mbtshoestoreonline.com/mbt-shoes-outlet.html"><strong>mbt shoes outlet</strong></a>
<a href="http://www.mbtshoestoreonline.com/clearance-mbt-shoes.html"><strong>clearance mbt shoes</strong></a>
<a href="http://www.mbtshoestoreonline.com/mbt-womens-shoes.html"><strong>mbt womens shoes</strong></a>
<a href="http://www.mbtshoestoreonline.com/discount-mbt-shoes.html"><strong>discount mbt shoes</strong></a>
<a href="http://www.mbtshoestoreonline.com/mbt-shoes-sale.html"><strong>mbt shoes sale</strong></a>
<a href="http://www.mbtshoestoreonline.com/mbt-shoes-online-store.html"><strong>mbt shoes online store</strong></a>
<a href="http://www.mbtshoestoreonline.com/mbt-mens-shoes.html"><strong>mbt mens shoes</strong></a>