1

Spring webflow で最初の ajax 呼び出し/応答を作成し、応答を thymeleaf でレンダリングしようとしています。pdf Thymeleaf + Spring 3 の thymeleaf の例を使用しました。

フロー構成:

<view-state id="detail" view="bookingDetail"> 
<transitionon="updateData">
<render fragments="hoteldata"/>
</transition>
</view-state>

私のhtml:

<div id="data" th:fragment="hoteldata">
This is a content to be changed
</div>

<script type="text/javascript" th:src="@{/resources/dojo/dojo.js}"></script>
<script type="text/javascript" th:src="@{/resources/spring/Spring.js}"></script>
<script type="text/javascript" th:src="@{/resources/spring/Spring-Dojo.js}"></script>
...
<form id="triggerform" method="post" action="">
<input type="submit" id="doUpdate" name="_eventId_updateData" value="Update now!" />
</form>
<script type="text/javascript">
Spring.addDecoration(
new Spring.AjaxEventDecoration({formId:'triggerform',elementId:'doUpdate',event:'onclick'}));
</script>

まず、次のように送信を無効にします。

 <input type="submit" id="doUpdate" name="_eventId_activeOrders" value="Update now!" onclick="return false;"/>

ページ全体のリロードを防ぎます。

ログで、SpringWebflow によってアクションが実行されていることがわかり、次のように表示されます。

Chrome Js コンソール:

Uncaught TypeError: Cannot read property 'method' of null Spring-Dojo.js:16
dojo.declare.submitForm Spring-Dojo.js:16
dojo.declare.submit Spring-Dojo.js:16
dojo.hitch

または Firefox コンソール:

TypeError: _1a is null
http://localhost:9092/resources/spring/Spring-Dojo.js
Line 16

どのように進めればよいのか、検索の問題をどこから始めればよいのかわかりません。誰にもアイデアがありますか?

4

1 に答える 1

0

DOJOがフォームタグを見つけられないかのように、確かにjavascriptの問題のように見えますtriggerform(属性を探していmethodますが、フォームオブジェクトがnullであると言います)...

トランジションactiveOrdersが実際にそのフォームを変更して削除したり、ここに表示されているものとは異なる HTML を出力している可能性がありますか? 「activeOrders」イベント部分なしで試すことをお勧めします。

transitiononところで、 SWF 構成にスペルミスのある属性があります (する必要がありますtransition on)

于 2012-11-30T09:05:11.243 に答える