使用Ajax下载并打开PDF文件我有一个生成PDF的动作类。该contentType适当地设定。public class MyAction extends ActionSupport {
public String execute() {
...
...
File report = signedPdfExporter.generateReport(xyzData, props);
inputStream = new FileInputStream(report);
contentDisposition = "attachment=\"" + report.getName() + "\"";
contentType = "application/pdf";
return SUCCESS;
}}我action 通过Ajax调用来调用它。我不知道将此流传递给浏览器的方法。我尝试过一些东西,但没有任何效果。$.ajax({
type: "POST",
url: url,
data: wireIdList,
cache: false,
success: function(response)
{
alert('got response');
window.open(response);
},
error: function (XMLHttpRequest, textStatus, errorThrown)
{
alert('Error occurred while opening fax template'
+ getAjaxErrorString(textStatus, errorThrown));
}});以上给出了错误:您的浏览器发送了此服务器无法理解的请求。
添加回答
举报
0/150
提交
取消