« Using Liferay に戻る

Portlet Communication Configuration

Table of Contents [-]

Introduction #

Liferay implements several communication mechanisms across portlets including those specified by the JSR-286 standard: public render parameters and events. Public render parameters are very easy to use, but are nevertheless quite powerful when used in the right situations. Liferay also provides a configuration UI that allows getting the best out of this communication mechanism.

The UI to configure the communication across portlets can be accessed by clicking the configuration icon in the upper right corner of the portlets (note that the exact position might vary depending on the theme being used). Once in the configuration UI, if the portlet supports comunication through public render parameters a screen similar to the following will be shown.

This screenshot in particular is for the wiki portlet, which has four public render parameters: nodeId, title, categoryId and tag. For each of this parameter the configuration UI allows the administrator to:

  • Ignore the values for this parameter that come from other portlets. For example, the wiki portlet can be used along with the tags navigation portlet so that when a user clicks on a tag of the latter, the wiki portlet shows the list of pages with that tag. In some cases an administrator may want the wiki portlet to always show the front page independently of any tag navigation done through other portlets. This can be achieved by checking the ignore checkbox so that the values of the parameter coming from those other portlets are ignored.
  • Read the value from the parameter from other portlet. This is an advanced but very powerful option that allows communicating portlets even if their developers didn't think of it. For example, imagine that the wiki portlet is used to publish information about certain countries. Also in the same page there is another portlet that allows browsing countries for administrative reasons. That second portlet has a public render parameter called "country" with the name of the country and we want the wiki to show the information from the country being browsed through the administration portlet. This can be achieved going through the portlet communication configuration UI for wiki and set it up so that the value for the title param is read from the country param (of the other portlet). Cool, isn't it?
1 画像の固定
41657 参照数
平均 (0 投票)
平均評価は0.0星中の5です。
コメント
コメント 作成者 日時
And what if I want to pass parameters from a... Alessandro Cosenza 2010/08/23 6:54
It looks as if it isn't just the parameter of... Brian Scott Schupbach 2012/04/24 13:13

And what if I want to pass parameters from a JournalContentFriendlyURLMapper (from populateParams method I guess) to An AssetPublisher portlet?
投稿日時:10/08/23 6:54
It looks as if it isn't just the parameter of "categoryId" that is passed in the URL but also an instance ID of the portlet. I have a custom portlet and I can get the categoryId but I cannot get the instance ID of the asset publisher. So, even though I'm passing in the categoryId under the parameter "categoryId" it doesn't work. Is there a way to communicate between portlets without needing to pass the instance Id along with the cateogryID?
投稿日時:12/04/24 13:13