i uso DOJO + Spring MVC, i call to a ExportPDF.html that generates me my pdf but as a result of my xhr function in my script, y have in the console caracthers like this @"x13&"#%" i think that is my pdf. how can i display in a new web page or permit to the client download it?
this is my exporPDF.html Controller
@RequestMapping(value = "/exportarPDF", method = {
RequestMethod.GET, RequestMethod.POST })
private @ResponseBody
void exportarPDF(@ModelAttribute("someBean") somebean someBean,
BindingResult result,HttpServletRequest request,HttpServletResponse response) throws Exception {
response.setContentType("application/pdf");
JasperReport mainReporte = (JasperReport) JRLoader.loadObject(mainJasper);
JasperPrint mainPrint = JasperFillManager.fillReport(mainReporte, parameters, new JRBeanCollectionDataSource(SOMELIST));
ServletOutputStream output = response.getOutputStream();
JasperExportManager.exportReportToPdfStream(mainPrint, output);
output.close();
}
My pdf generate greats, but i can see in a page or download it, please help me
and this is my script method
xhr("exportarPDF.html", {
query : {
someValue: This Value is received well in the Spring Controller
},
handleAs : "json",
method : "post"
}).then(function(data) {
//I thinks this data is my pdf!
}, function(err) {
alert("Error Interno");
}, function(evt) {
// Handle a progress event from the request if the
// browser supports XHR2
});
This is my debug with firebug