Ajax + Spring Webflow

Firstly, I use spring web stream and some javascript spring to make ajax calls easier.

As of now, I have ajax to call the web stream to display the corresponding fragment.

So, I am trying to use Spring.AjaxEventDecoration for my ajax needs for my application. However, I am having some problems with this method and the web stream, and from what I can say there are very few examples available to work with.

On a side note, I do not use a form or selection box. I thought I mentioned this because every example I found used a submit form / form with an onlick event or a select box with an onchange event.

The main question is : if I have a method in my web stream with parameters coming from my ajax, can I pass parameters from ajax to webflow?

The code:

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

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

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

So, I would suggest that requestParameters.currentPId in the web stream does not pull currentPId from the ajax call.

Is this expected? Can someone explain and give an example?

I would be grateful for the help provided.

Adam

+8
ajax spring-webflow
source share
1 answer

If you think the problem is with the ajax call, it would be helpful if you write ajax call here so we can check if the call is being executed correctly.

You can try to pass the form serialized in the data parameter when making an ajax call. Also, be sure to add the ajaxSource parameter to the URL. I hope for this help.

HTML example:

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

JQuery example:

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

All Articles