To do this we have to use the tlds :
liferay-portlet:renderURL
liferay-portlet:actionURL
and the concepts of
plid: referenced page layout id
portletName: referenced portlet name
The   renderURL and the actionURL are tags provided by Liferay that extend   the standard tlds. Note: this kind of communication is not part of the   standard of the portlets JSR168 and JSR286.
- The plid is the   id of the page where we deploy one portlet, we can use   LayOutLocalService to seek the id, or query it in the database directly.
 
- The  portletName is the identifier of the portlet and is part of the   deployment descriptor of the portlet. This id is composed by   portletId+_WAR_+thenameofwarthatencapsulatestheportlet and optionally   the _INSTANCE_ if the portlet is instanciable.
 
If we have one portlet, and we use this tld into the jsp:
<liferay-portlet:renderURL   plid="13605" portletName="mynews_WAR_myresourcesportlet"   var="prueba"></liferay-portlet:renderURL> and  this portlet  creates a link to other portlet, in this case,   mynews_WAR_myresourcesportlet located in the page with plid 13605. This   link is a render link.
The next sample shows how to create an actionURL:
<liferay-portlet:actionURL   name="newMyNew" plid="13605"   portletName="mynews_WAR_myresourcesportlet"   var="prueba2"></liferay-portlet:actionURL>
We can also pass parameters:
<liferay-portlet:renderURL plid="13605" portletName="mynews_WAR_myresourcesportlet" var="prueba">
  <liferay-portlet:param name="resourcePrimKey" value="123456" />
</liferay-portlet:renderURL>
If the plid is not used, the portal assumes that the portlets are located into the same page.
You deal quite well with portlets. I see that's how it should have been done. I get the pass parameters command bit mixed up sometimes.
ReplyDeleteNice!! Strangely, I found the same article here also
ReplyDeletehttp://www.zylk.net/web/guest/web-2-0/blog/-/blogs/how-to-link-portlets-located-on-different-pages-in-liferay-portal
Excellent Stuffs. Thank you Sir !
ReplyDeleteNicely done
ReplyDeleteIt works like a charms! Thanks!!
ReplyDelete