Return Excel Application Content Type when Sending action


my form contains a button (named “generate”) and i attached send(url,post method) event when click.

So in javascript :

myForm.attachEvent("onButtonClick", function(name) { if(name=="generate"){ this.send("myURL/writeExcel","post"); } });

writeExcel is my servlet name responsible to construct response who actually is excel application type…
In Java code :

response.setContentType("application/"); response.setHeader("Content-Disposition", "attachment; filename=myFile.xls");

So this servlet works perfectly with a classic form post action ! But in this particular situation with Dhtmlx form, servlet is called and generate datas, but nothing appends next… (no client or server side errors…).

If anyone have an idea i would appreciate his knowledge !


This is because form send data using ajax.

If you need to download something, create hidden iframe,
and set corresponding link to it src instead of submitting form.