Faces アクションおよびコンポーネントからのポートレット API オブジェクトのアクセス

Faces ポートレットを作成する場合、ポートレット変数リゾルバーが、/WEB-INF/faces-config.xml で定義されます。 ポートレット変数リゾルバーにより、次の構成オブジェクトとのバリュー・バインディングの使用が可能になります。
ポートレット API タイプ 構成オブジェクト バリュー・バインディング
JSR 168 API PortletPreferences #{portletPreferences.attribute name}
IBM ポートレット API PortletApplicationSettings #{portletApplicationSettings.attribute name}
PortletSettings #{portletSettings.attribute name}
PortletData #{portletData.attribute name}

ポートレット JSP ファイルの「ページ・データ」ビューを使用して、属性を定義し、それらの属性を Faces コンポーネントにバインドしてください (ポートレット JSP ファイルから構成オブジェクトへのアクセスを参照)。

PortletRequest、PortletResponse、および PortletContext は、以下のように facesContext の ExternalContext メソッドから取得できます。
PortletRequest request = (PortletRequest)facesContext.getExternalContext().getRequest();
PortletResponse response = (PortletResponse)facesContext.getExternalContext().getResponse();
PortletContext context = (PortletContext)facesContext.getExternalContext().getContext();

Faces アクションのために IBM ポートレット API の ActionEvent クラス (org.apache.jetspeed.portlet.event.ActionEvent) にアクセスしたい場合は、次のように要求属性から取得できます。

ActionEvent event = (ActionEvent)facesContext.getExternalContext().getRequestMap().get("com.ibm.faces.portlet.ACTION_EVENT");
関連概念
「ページ・データ」ビュー
関連タスク
ポートレット JSP ファイルから構成オブジェクトへのアクセス

(C) Copyright IBM Corporation 2002, 2004. All Rights Reserved. (C) Copyright IBM Japan 2005