ポートレット調整
イベント・メカニズムまたはパブリックなレンダリング・パラメーター・メカニズムのいずれかを使用して、ポータル内のポートレットを調整できます。
JSR 286 では、これらの 2 つのメカニズムを次のように定義しています。
- イベント: アクション・フェーズ時のポートレットの疎結合。
- パブリックなレンダリング・パラメーター: ポートレット間でのビュー状態の共有
WebSphere® Application Server のポートレット・コンテナーは両方の概念をサポートしていますが、例外が 1 つあります。ポータル・レベルでのイベントのワイヤリングはサポートされません。
集約タグ・ライブラリーで定義されているポータル・ページでパブリックなレンダリング・パラメーターを使用するには、ポータルの有効範囲を明示的に宣言する必要があります。
<%@ taglib uri="http://ibm.com/portlet/aggregation" prefix="portlet" %>
<%@ page isELIgnored ="false"%>
<!-- define portal scope for public render parameters -->
<portlet:scope>
<portlet:portlet context="/simpleportlet" portletname="SimplePortlet1" windowId="id1"/
<portlet:portlet context="/simpleportlet2" portletname="SimplePortlet2" windowId="id2"/>
</portlet:scope>
<portlet:init portletURLPrefix="/my-webapp-context/my-portal-jsp-url-pattern/">
<!-- insert your portlets here, wrapped with your html markup -->
...
<portlet:insert url="simpleportlet/SimplePortlet1" windowId="id1" titleVar="portlettitle_1"/>
...
<portlet:insert url="simpleportlet2/SimplePortlet2" windowId="id2" titleVar="portlettitle_1"/>
...
</portlet:init>
パブリックなレンダリング・パラメーターは、この定義されている有効範囲内に記述されているポートレット・ウィンドウに対してのみ表示されます。この条件では、前提条件として、対応するポートレットも、JSR 286 仕様に従って、portlet.xml ファイルで所定のパブリックなレンダリング・パラメーターのサポートを宣言済みであるものとします。
...
<portlet>
<portlet-name>portlet_name1</portlet-name>
...
<supported-public-render-parameter>foo</supported-public-render-parameter>
</portlet>
<portlet>
<portlet-name>portlet_name2</portlet-name>
...
<supported-public-render-parameter>foo</supported-public-render-parameter>
</portlet>
<public-render-parameter>
<identifier>foo</identifier>
<qname xmlns:x="http://example.com/params">x:foo2</qname>
</public-render-parameter>
...