Thymeleaf Spring Webflow Ajax

I am trying to make my first ajax call / response with Spring webflow, and response rendered with thymeleaf. I have used thymeleaf example from their pdf Thymeleaf + Spring 3.

flow config:

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

my html:

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

and

<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>

First I disable submit with:

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

to prevent whole page reload.

In logs I see that action is executed by SpringWebflow and then I see :

Chrome Js console:

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

or Firefox console:

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

I am not sure how to proceed or where to start search problems. Anybody have ideas?

查看全部
weixin_33712987
weixin_33712987
2012/11/29 15:11
  • thymeleaf
  • ajax
  • 点赞
  • 收藏
  • 回答
    私信

1个回复