weixin_33712987 2012-11-29 15:11 采纳率: 0%
浏览 24

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?

  • 写回答

1条回答 默认 最新

  • weixin_33722405 2012-11-30 09:05
    关注

    It certainly looks as a javascript problem, as if DOJO isn't finding your triggerform form tag (it's looking for its method attribute but says the form object is null)...

    Could it be that your activeOrders transition is actually modifying that form and removing it, or maybe outputting different HTML for it than the one you show here? I'd suggest trying without the "activeOrders" event part.

    And btw, you have a misspelled transitionon attribute in your SWF configuration (should be transition on)

    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?