af:returnActionListenerおよびダイアログ戻り値について

ADF Facesのaf:returnActionListenerタグは、標準のActionSourceインタフェースを実装するコンポーネントで使用できます。

このaf:returnActionListenerタグには、アクション・ソース(commandButtoncommandLinkなど)がダイアログまたはプロセスから値を戻す宣言方式が用意されています。value属性はEL式または定数値にできます。

たとえば、「Select」ボタンがあるダイアログ・ページの場合は、次のようになります。

<af:commandButton text="Select" ..>
  <af:returnActionListener value="#{mybackingbean.table1.selectedRowData.Empno}"/>
</af:commandButton>    

ここで、mybackingbeanは表のバッキングBean、table1はその表を取得するバッキングBeanのプロパティです。

「Select」ボタンがtableSelectOneにある場合は、次のようになります。

<af:tableSelectOne>
  <af:commandButton text="Select">
    <af:returnActionListener value="#{row.Empno}"/>
  </af:commandButton>
</af:tableSelectOne>    

また、af:returnActionListenerタグは、処理を取り消し、値を戻さずにダイアログ・ウィンドウを閉じる際にも使用できます。たとえば、「Cancel」ボタンがダイアログ・ページにある場合は、次のようになります。

<af:commandButton text="Cancel" ..> 
  <af:returnActionListener/> 
</af:commandButton >     

ADF Facesコマンド・コンポーネントからのダイアログの起動について