I am application is based on struts and in one of the module I am generating reports in pdf and excel format .The reports gets generated in system directory but download pop up dosen't appear on browser .
This is my .xml mapping of action
<action name="report" class="reportAction" method="generateReport">
<result name="success" type="stream">
<param name="contentType">application/octet-stream</param>
<param name="inputName">fileInputStream</param>
<param name="contentDisposition">attachment;filename=${filename}</param>
<param name="bufferSize">1024</param>
</result>
<result name="error">
</result>
</action>
this is my cal to action from jsp :-
function fetchReport()
{
//alert("I am here");
$.ajax({
type : "POST",
url : "report.action",
data : jQuery("#parameterGrid").serialize(),
async : false,
success : function(dataJSP) {
//alert("Hi");
//alert(dataJSP);
/* jQuery("#showReportDIV").load("Please wait...").html(
dataJSP); */
return true;
}
});
}
Now I have changed my button on whose click event I generate the report to :-
<sj:submit button="true"
theme="simple" onclick= "fetchReport();" key="Generate Report" />
now the pop up appears but a flat file is download ,I have to browse to open it either in excel or pdf