ビジネス・コンポーネント・データ・タグを使用した行の更新

ビジネス・コンポーネント・データソースで編集する行の選択を行うJSPページは、HTTPリクエスト・オブジェクトを介して、送信ページでの処理のために次のものをフォワードする必要があります。

アプリケーション・モジュール・インスタンスおよびビュー・オブジェクト・データソースに対してこれを実行するには、これらのビジネス・コンポーネント・データ・タグで2つのJSPページを作成します。

編集JSPページ

  1. 希望するビジネス・コンポーネント・データ・タグをHTMLフォーム要素に追加します。データ・タグは、ビュー・オブジェクト・データソースの指定した属性にバインドされたフォーム要素をレンダリングします。たとえば、次のコードを使用できます。

    <form name="edit" action="formSubmit.jsp" method="post">
      <table>
       <%-- Iterate through all the attributes of the current record --%>
       <jbo:AttributeIterate id="def" datasource="ds">
         <tr>
           <%-- Display attribute name and render value --%>
           <td align="right"><jbo:ShowHint hintname="LABEL" /></td>
           <td align="right"><jbo:RenderValue datasource="ds" /></td>
         </tr>
       </jbo:AttributeIterate>
      </table>
    </form>

  2. 既存の行を編集する場合は、編集イベントを処理する送信ページへのHREFを作成します。 <jbo:UrlEvent>データ・タグを使用し、必要なビジネス・コンポーネント識別子を渡します。

    <form name="edit" action="formSubmit.jsp" method="post">
      <table>
       <%-- Iterate through all the attributes of the current record --%>
       <jbo:AttributeIterate id="def" datasource="ds">
         <tr>
           <%-- Display attribute name and render value--%>
           <td align="right"><jbo:ShowHint hintname="LABEL" /></td>
           <td align="right"><jbo:RenderValue datasource="ds" /></td>
           <%-- Submit the jboEvent with the URL --%>
           <td> <a href="<jbo:UrlEvent targeturlparam='formSubmit.jsp'
                          event='Edit' datasource='ds' addrowkey='true'/>">Edit</a> </td>
         </tr>
       </jbo:AttributeIterate>
      </table>
    </form>

送信JSPページ

  1. Editイベントを使用してビジネス・コンポーネント<jbo:OnEvent>データ・タグを追加し、編集ページで指定したものと同じデータソース上でHTTPリクエスト・オブジェクトを処理するGetアクションを使用して、ビジネス・コンポーネント<jbo:Row>データ・タグをネストします。

    <jbo:OnEvent name="Edit" datasource="ds">
       <jbo:Row id="delrow" rowkeyparam="jboRowKey" action="Get" </jbo:Row>
    </jbo:OnEvent>

  2. HTMLフォームを作成してビジネス・コンポーネント・データ・タグを使用することによって、現在のレコードのすべての属性を反復し、属性名を表示し、現在の値で入力フィールドをレンダリングします。

    <form name="submit" action="formSubmit.jsp" method="post">
      <table>
       <%-- Iterate through all the attributes of the current record --%>
       <jbo:AttributeIterate id="def" datasource="ds">
         <tr>
           <%-- Display attribute name --%>
           <td align="right"><jbo:ShowHint hintname="LABEL" /></td>
           <%-- Display input field with current value --%>
           <td><jbo:InputRender formname="edit" /></td>
         </tr>
       </jbo:AttributeIterate>
      </table>
    </form>

  3. ビジネス・コンポーネントPostまたはCommitデータ・タグ(あるいはその両方)を追加し、データソースへの変更をデータベースに適用します。

タスク実行時にJSPページでアクセスするアプリケーション・モジュール・オブジェクトには、送信JSPページが更新を完了するまで、リザーブ・モードでアクセスする必要があります。 JSPページに追加する<jbo:ApplicationModule>データ・タグのreleasemode属性が、この動作を制御します。


ビジネス・コンポーネント・データ・タグについて
ビジネス・コンポーネント・データ・タグを使用した行の編集について
ビジネス・コンポーネント・フォームのInputデータ・タグについて

次のトピックは、ビジネス・コンポーネント・データ・タグのリファレンスです。

リファレンス: ビジネス・コンポーネント・データ・タグ・ライブラリ

 

Copyright © 1997, 2004, Oracle. All rights reserved.