ajax使用get请求调用webflow

时间:2015-09-03 05:37:27

标签: ajax spring spring-webflow spring-js

我可以使用带有ajax的webflow使用POST,但不能使用GET。

我的页面顶部有一个父对象。我在页面底部列出了一些潜在的孩子。用户选择"添加"由潜在的孩子链接以添加到父母。

完整形成的html如下:



<tr>
   <td><a href="/prototype2/xzcreatetesttype.html?execution=e2s1&amp;_eventId=addtut&amp;tutid=148&amp;tutname=Advanced%20French">Add</a></td>
	<td>Advanced French</td>
</tr>
<tr>
	<td><a href="/prototype2/xzcreatetesttype.html?execution=e2s1&amp;_eventId=addtut&amp;tutid=81&amp;tutname=Algebra%20One">Add</a></td>
	<td>Algebra One</td>
   </tr>
&#13;
&#13;
&#13;

然而,这会刷新整个页面。我如何使这个ajax调用,所以我只刷新一个片段(即父母指定的孩子)。

注意:我的问题是关于形成对webflow的调用。我知道如何render the result

1 个答案:

答案 0 :(得分:0)

以下是这里提出的问题的答案。我不确定javascript params片段参数是否必要,因为要渲染的片段在webflows中指定&#34;渲染片段。&#34;这个函数似乎没有这个论点。

&#13;
&#13;
<table id="bodyInnerTable"
	style="border: 1px solid #007589; width: 100%; vertical-align: top">
	<tr>
		<td id="bodyMainCellHead" colspan="2" th:text="#{label.availabletuts}">Name</td>

	</tr>
	
	<!-- Iterate through the children (retrieved from db and held in bean as TreeMap) 
	Each <a> tag must have a unique th:id. The name attribute applies to all children in list
	
	-->
	<tr th:each="tut : ${vwNewTestType.tutMap}" th:if="${vwNewTestType.tutMap.size() > 0}">
		<td><a th:id="${tut.value}" name="addtutname"
			th:href="@{'~' + ${flowExecutionUrl}(_eventId=addtut, tutid=${tut.value},tutname=${tut.key})}">Add</a></td>
		<td th:text="${tut.key}">id</td>
	</tr>
</table>


<!-- dojo .forEach will then allow for identification of which element  is clicked and the webflow transition on=""addtut" is called-->

<script type="text/javascript">
	
	
	dojo.query("a[name=addtutname]").forEach(function(element) 
			{
			    Spring.addDecoration(new Spring.AjaxEventDecoration({
			        elementId: element.id,
			        event: "onclick"
			        //params: {  fragments:"s2,s4"}
			    }))
			});
</script>
&#13;
&#13;
&#13;

相关问题