The Source for Java Technology Collaboration
User: Password:



Start New Message Delete Post a Reply

Article: 
 Developing AJAX Applications the Easy Way
Subject:  Solution Required for Problem in "Ajax in Struts-based Web Application"
Date:  2006-02-09 03:30:35
From:  bibroy


A highlevel view of the pseudo-code is follows:

AjaxFunctionOuter (){

....some code specific to AjaxFunctionOuter

for-loop(...){

AjaxFunctionInner ();

}

}





AjaxFunctionOuter works fine in all the cases both in terms of request-dispatch and response-processing

The problem is related to AjaxFunctionInner which is described in the following paragraphs:


Case I: [when the req.open(.., ..., true) for AjaxFunctionInner ]

AjaxFunctionInner does work in terms of request-dispatch to struts-action for all the iteration in the for-loop.

AjaxFunctionInner does NOT work in terms of response-processing except for the last iteration in the for-loop.


This case is same for IE and mozilla-based browsers(such as netscape, firefox, mozilla).


Case II: [when the req.open(.., ..., false) for AjaxFunctionInner ]


A)

For IE:

AjaxFunctionInner does work in terms of request-dispatch to struts-action for all the iteration in the for-loop.

AjaxFunctionInner does work in terms of response-processing for all iterations in the for-loop.


B)

For mozilla-based browsers:

AjaxFunctionInner does NOT work in terms of request-dispatch to struts-action for all the iteration in the for-loop.

AjaxFunctionInner does NOT work in terms of response-processing for all the iteration in the for-loop.[THIS IS OBVIOUS]


Now what appears from the above 2 cases is that for multiple-sequential ajax requests (such as those that might occur in a

for loop) there appears to be some issue related to intercepting the response and subsequent processing.


Case II (A) do not offer much hope since it defeats the very purpose of "A" of AJAX.

Now I have been through quite a handful of articles/FAQ related to AJAX, but to no avail.

I have tried Javascript closures, but that too do not seem to work.


Note: I am using POST (in call to open method) for all cases since I am doing form submission.


Let me know if anyone has a solution to offer in view the above perspective and also whether I am missing something.

 Feed java.net RSS Feeds