Need to add that I'm using Java/Struts/JSP; in struts-config there are mapped the paths with forms and actions (the action is based on parameter 'dispatch').
What I want to achieve is to download some files. I have a list of owes corresponding to an employee, and each one of this has a corresponding file as proof.
So to each file, there's a button attached in the JSP code, which loooks like this:
The initial 'downloadProof' method does this:
function downloadProof(oweId, event)
dojo.byId("dispatch").value = "downloadProof";
dojo.byId("oweId").value = oweId;
load: function(response, args)
error: function(response, args)
dojo.byId("errorAjaxMessage").innerHTML = dojo.toJson(response);
Aparently all code's allright, the JSP, the JS, the action in the java class, connection to server & file download when you first try it.
this JS method should call the 'downloadProof' method from the action associated to the form.
Problem appears when you try to open/download more than one file. I mean, I have the list of buttons, the first one that I press runs perfectly, and after this pressing it has absolutelly no effect.
From what I read, the problem seems to be dojo.io.iframe.send, because, as some say, loads only once per page load OR it simply doesn't know when it has finished doing it's job, so the rest of calls will be stored in a queue - couldn't figure it out what makes the next in queue to trigger (http://api.dojotoolkit.org/jsdoc/1.3.2/dojo.io.iframe.send). And it makes sense, the behaviour I get conforms to all these.
var def = new dojo.Deferred();
var s = "In ERR handling; response.message: " ;
alert(s + "deferred's value:"+deferred);
I wasn't able to understand the documentation presented, and I couldn't find a proper example of CANCELLING the DEFERRED object. I don't understand what is suppose to happen to a canceled deferred, as this is pretty vague to me: http://api.dojotoolkit.org/jsdoc/1.3.2/dojo.Deferred.
I don't know if I have implemented well the errback on cancel. From what I experience, my code goes into downloadPFError (the addErrback of the deferred) only ONCE. And again, it enters IFRAME.SEND only once, the first trial, and I cannot get more than one file.
The official Dojo forum is closed, not to mention that the API and resources found on Internet are extremelly poor.
I've even started to read the API from TWISTED, as I understand that the Deferred method has been inspired by this and honestly, I understood more from here than from the Dojo API. If I see another example of deferred that only involves setTimeout I'll go coocoo.
All apologies if this is not the right place for this, and please you all don't take all this the wrong way, as you can tell I'm getting a little impacient.
So everybody reading this, have you experienced anything similar?
If you have more experience in this, can you please tell me what's wrong with my code?
Where can I find a complete example of a Deferred object, that is cancelled? (besides looking into the source code of pages on internet)
And what can I do or use to be able to download more than one file?
Please be sure to use code tags when posting code to the forums. Unformatted or unindented code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please click this link ⇒ UseCodeTags ⇐ for more information.
Properly indented and formatted code greatly increases the probability that your question will get quicker, better answers.