我正在使用Spring MVC。我不想在浏览器中显示我的URL,因为我在其中传递了id。我正在使用AJAX请求,我正在使用http://johnculviner.com/jquery-file-download-plugin-for-ajax-like-feature-rich-file-downloads/ URL中的jquery.fileDownload.js文件来下载文件
我的javascript代码是
功能打印(值) {
var myurl ='PropertyTaxRegistration.html?PrintReport& assid ='+ value;
$。fileDownload(myurl,{
successCallback: function (url) {
alert('You just got a file download dialog or ribbon for this URL :' + url);
},
failCallback: function (html, url) {
alert('Your file download just failed for this URL:' + url + '\r\n' +
'Here was the resulting error HTML: \r\n' + html
);
} }); }
我的java代码是
JasperDesign jasperDesign = JRXmlLoader.load(jrxmlFileLocation);
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, map, new JRBeanCollectionDataSource(dataCollection));
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, (OutputStream) response.getOutputStream());
//JasperExportManager.exportReportToPdfStream(jasperPrint, (OutputStream) response.getOutputStream());
response.setContentType("application/pdf");
response.getOutputStream().flush();
response.getOutputStream().close(); return true;
我正确地进入java课程。 但是在每种情况下它都是错误的,即failCallback函数并给出错误消息;
请帮助解决我的错误。
提前致谢