1

Orbeon Formsソリューションを使用して、入力されたWebフォームからメッセージを生成しています。

パイプラインからのXForms送信に関するOrbeonのwikiでさまざまなコードスニペットを読み、さまざまな解決策を試しましたが、機能しません。パイプラインからのPOSTを使用して、PFCによってキャッチされ、XFormsビューに送信された例はありません。投稿されたデータを受け取ります(すべての例は同じページで行われます)。

彼のインスタンス入力で受信される次のパイプラインがあります。

PipelineWrite.xpl

<p:config ...>
    <p:param name="instance" type="input"/> <!-- instance containing the data of the form filled by user -->
    <p:param name="data" type="output"/>

    <p:processor name="oxf:java"> <!-- transforms the data into a file -->
        <p:input name="config">
            <config sourcepath="." class="ProcessorWriteCUSDECCD001B"/>
        </p:input>
        <p:input name="input" href="#instance"/>
        <p:output name="output" id="file"/> <!-- XML containing the url of the file -->
    </p:processor>       
</p:config> 

次に、アクションをキャッチするPFCがあります。

page-flow.xml

<config xmlns="http://www.orbeon.com/oxf/controller">

    <page path-info="/CUSDECCD001B/" view="View/ViewForm.xhtml"/> <!-- load the form to be filled in by user -->

    <page path-info="/CUSDECCD001B/write" model="Controller/PipelineWrite.xpl"/> <!-- send the instance of the form filled to the pipeline above -->

    <page path-info="/CUSDECCD001B/success" view="View/ViewSuccess.xhtml"/> <!-- send the instance containing the url of the file to the success view -->

    <epilogue url="oxf:/config/epilogue.xpl"/>
</config> 

次に、非常に単純な成功ビューがあります。

ViewSuccess.xhtml

<html ... >
  <head>
    <title>Generation OK</title>
    <xforms:model>
            <xforms:instance id="FILE" src="input:instance">
                <files xmlns="">
                    <file mediaType="" filename="" size="" />
                </files>
            </xforms:instance>
        </xforms:model>
  </head>
  <body>
        Click here to download :
        <xforms:output ref="//file" appearance="xxforms:download">
            <xforms:filename ref="@filename"/>
            <xforms:mediatype ref="@mediatype"/>
            <xforms:label>Download</xforms:label>
        </xforms:output>
  </body>
</html> 

「ViewModify」ページの「保存」ボタンをクリックして起動したこのプロセスはすべて、次のとおりです。

ViewModify.xhtml

<xforms:model>
    <xforms:instance id="CUSDECCD001B" src="../apps/CUSDECCD001B/Model/ModelCUSDECCD001B.xml" />
    <xforms:submission id="save-submission" ref="instance('CUSDECCD001B')" action="/CUSDECCD001B/write" replace="instance" instance="CUSDECCD001BFile">
        <xforms:send ev:event="xforms-submit-done" submission="send-to-success"/>
    </xforms:submission>
    <xforms:submission id="send-to-success" method="post" action="/CUSDECCD001B/success" ref="instance('CUSDECCD001BFile')" replace="all"/>
</xforms:model>

  <!-- .... Content of XForms form -->

<xforms:submit submission="save-submission">
    <xforms:label>Save</xforms:label>
</xforms:submit>

問題は、投稿が適切に行われ、PFCがアクションを適切にキャッチし、正しいビューをロードしますが、ビューはデータなしでロードされます(ビューはインスタンス入力のデータを検出しません)。

ビューでGETを使用してPOSTデータを取得しようとしましたが、それは同じことです。データは取得されません。そのため、ダウンロードボタンは機能しません。

私は解決策を見つけるのに十分明確であることを願っています。前もって感謝します。

4

2 に答える 2

1

プロセッサから使用する場合にのみxforms:submission replace="instance"意味があります。oxf:xforms-submissionしたがって、送信の結果はXMLを返す必要がありますが、XFormsページに送信すると、HTMLが返されるため、ここでは機能しません。

に送信するフォームがあると思いreplace="all"ます/CUSDECCD001B/write。その代わり:

  1. 送信replace="instance"を行い、結果をインスタンスに保存します。
  2. 代わりに、XF ​​orms送信プロセッサーを呼び出さずに、JavaプロセッサーpipelineWrite.xplの出力を直接返します。file
  3. に送信を行うXFormsに戻り、その送信replace="instance"/CUSDECCD001B/write完了したら(xforms-submit-done)、結果をにPOSTする別の送信を実行し/CUSDECCD001B/successます。
于 2010-06-01T22:49:59.257 に答える
0

Alessandro adivcesを考慮に入れ、Orbeon wikiで他のコードスニペットを検索した後、これが私にとってうまく機能するソリューションです:

インスタンス入力で入力されたフォームインスタンスを受け取るパイプライン:

piplineWrite.xpl

<p:param name="instance" type="input"/>
<p:param name="data" type="output"/>

<p:processor name="oxf:java">
    <p:input name="config">
        <config sourcepath="." class="ProcessorWrite"/>
    </p:input>
    <p:input name="input" href="#instance"/>
    <p:output name="output" ref="data"/>
</p:processor>

PFCはアクションをキャッチし、対応するアクションを起動します。

page-flow.xml

<config xmlns="http://www.orbeon.com/oxf/controller">
    <page path-info="/CUSDECCD001B/write" view="Controller/PipelineWrite.xpl"/>
    <page path-info="/CUSDECCD001B/success" view="View/ViewSuccess.xhtml"/>
    <epilogue url="oxf:/config/epilogue.xpl"/>
</config>

ビュー処理後のデータ出力の受信成功:

viewSuccess.xhtml

<html ...>
  <head>
    <xforms:model>
        <xforms:instance id="FILE" src="input:instance"/>
    </xforms:model>
  </head>
  <body>

    <p> Generation Success !</p>

    <div class="toolbar">
        Cliquer to download :
        <xforms:output ref="//file" appearance="xxforms:download">
            <xforms:filename ref="@filename"/>
            <xforms:mediatype ref="@mediatype"/>
            <xforms:label>Download</xforms:label>
        </xforms:output>
    </div>
  </body>
</html>

プロセス全体を起動する「保存」ボタンで変更するビュー:

viewModify.xhtml

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events">
  <head>
    <xforms:model>
      <xforms:instance id="CUSDECCD001BFile">
        <dummy xmlns="" />
      </xforms:instance>
      <xforms:submission id="save-submission" ref="instance('CUSDECCD001B')" action="/CUSDECCD001B/write" method="post" replace="instance" instance="CUSDECCD001BFile">
        <xforms:action ev:event="xforms-submit">
          <xforms:send submission="send-submission" />
        </xforms:action>
      </xforms:submission>
      <xforms:submission id="send-submission" ref="instance('CUSDECCD001BFile')" action="/CUSDECCD001B/success" method="post" />
    </xforms:model>
  </head>
  <body>
    ...
    <xforms:submit submission="save-submission">
      <xforms:label>Save</xforms:label>
    </xforms:submit>
  </body>
</html>

以前のコードスニペットの主な問題と与えられたアドバイスは次のとおりです。

  • <xforms:instance>を指定する必要があります。resource=""または、少なくともデフォルトのコンテンツが含まれています(ここ<dummy />)。
  • イベントが機能してxforms-submit-doneいないか、存在していないようです。そこで、xforms-submitイベントを利用しました。
于 2010-06-06T20:52:53.763 に答える