3

トランジションでサービスを直接呼び出すことの違いを知りたい

<transition name="createExample">
    <service-call name="org.moqui.example.ExampleServices.createExample" in-map="ec.web.parameters"
                  web-send-json-response="true"/>
    <default-response type="none"/>
</transition>

のようなアクションタグ内でサービスを呼び出す

<transition name="createExample">
    <actions>
        <service-call name="org.moqui.example.ExampleServices.createExample" in-map="ec.web.parameters"
                  web-send-json-response="true"/>
    <actions>
    <default-response type="none"/>
</transition>

どちらの場合でも、Web パラメータはどのように処理されますか?

AngularJS を入力パラメーターとして使用して JSON で配列のマップを送信すると、両方のケースで異なる方法で解析されていました。

サービス呼び出しがアクション タグの内側または外側にある場合、パラメータは両方のケースで異なる方法で解析されていました。

Parameters in JSON 
var parameters = { exampleId : ["example1","example2","example3"]};

ec.web.parameters for service-call in actions tag
exampleId : [example1, example2, example3]

ec.web.parameters for service-call outside actions tag
exampleId : [example1,  example2,  example3]

リスト内の要素には、アクション タグの外側にサービス用の余分なスペースが含まれます。

では、このように動作するはずですか?

4

1 に答える 1

1

どちらの場合も、service-call.@in-map 属性で使用する in-parameters を明示的に指定しているため、この例ではどちらも同じです。service-call 要素が transition 要素の直下 (actions 要素内ではない) にあり、@in-map が指定されていない場合、デフォルトで現在のコンテキストになり、@out-map についても同じです。service-call が actions 要素内にある場合、これらのデフォルトはありません。つまり、コンテキストまたはその他のインマップまたはアウトマップを使用する場合は、それらを明示的に指定する必要があります。

画面、画面遷移、遷移に関連付けられたときにフォームがどのように動作するかについての詳細は、Making Apps with Moqui ブック (moqui.org Web サイトからダウンロードできます) にあります。

于 2015-02-12T05:17:09.307 に答える