阿贾克斯+春天的Webflow [英] Ajax + Spring Webflow

查看:482
本文介绍了阿贾克斯+春天的Webflow的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我使用的春天Webflow的一些春天的JavaScript,使AJAX调用更简单。

First, I am using spring webflow and some spring javascript to make ajax calls easier.

截至目前,我有AJAX拨打电话到的Webflow显示相应的片段。

As of right now, I am having ajax make a call into webflow to display the appropriate fragment.

所以,我尝试使用Spring.AjaxEventDecoration我为我的应用程序的AJAX需求。不过,我有这种方法的Webflow,并从我可以告诉一些麻烦,还有一起工作提供很少的例子。

So I am attempting to use Spring.AjaxEventDecoration for my ajax needs for my application. However, I am having some trouble with this method and webflow and from what I can tell, there are very few examples available to work with.

在一个侧面说明,我没有使用表单或一个选择框。我以为我会提到这一点,因为每一个例子,我发现已经使用的形式/表单提交与点击数事件或选择框onchange事件。

On a side note, I am not using a form or a select box. I thought I would mention this since every example I've found has used a form/form submit with onlick event or select box with onchange event.

主要问题:如果我在我的Webflow有参数从我的阿贾克斯未来的方法,可我居然传递来自阿贾克斯的参数Webflow的?

Main question: if I have a method in my webflow that has parameters coming from my ajax, can I actually pass in the parameters from ajax to webflow?

code:

<transition on="disassociateProperty" >
     <evaluate expression="dService.disassociateProperty(requestParameters.currentPId ,currentD)"  result="flowScope.currentD" />
<render fragments="PList" />
</transition>

所以,当我看着萤火虫的Ajax调用,它有我传递(currentPId)的参数和正确的事件ID。

So, when I look at the ajax call in firebug, it has the parameter I'm passing in (currentPId) and the correct eventId.

我把一个调试点就disassociateProperty方法的第一行,它告诉我currentPId为空。

I put a debug point on the first line of the disassociateProperty method and it tells me currentPId is null.

所以我会承担requestParameters.currentPId在Webflow的不是从Ajax调用拉动currentPId。

So I would assume requestParameters.currentPId in webflow isn't pulling the currentPId from the ajax call.

时这正常吗?任何人都可以解释和举个例子?

Is this expected? Could anyone explain and give an example?

我会AP preciate提供任何帮助。

I would appreciate any help provided.

亚当

推荐答案

如果你认为问题来自Ajax调用,如果你写在这里的Ajax调用这将是有帮助的,所以我们可以检查呼叫正在做正确的。

If you think that the problem comes from ajax call, it would be helpful if you write here the ajax call, so we could check if the call is being done correctly.

您可以尝试通过的形式做Ajax调用时,系列化中的数据参数。另外,不要忘记添加 ajaxSource 参数中的URL。希望这有助于。

You could try to pass the form serialized in the data parameter when doing the ajax call. Also, do not forget to add the ajaxSource parameter in the URL. Hope this help.

HTML例如:

<form id="formId" method="post" action="${flowExecutionUrl}&_eventId=disassociateProperty">
    <input type="text" id="currentPId" />
</form>

jQuery的例子:

jQuery Example:

$.ajax({
        type: "POST",
        data: $("#formId").serialize(),
        url: $("#formId").attr("action") + "&ajaxSource=true",
        ...
});

这篇关于阿贾克斯+春天的Webflow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆