这是我的action的代码:
[code="java"]HttpServletResponse response = ServletActionContext.getResponse();
OutputStream out = null;
FileInputStream in = null;
try
{
response.setContentType("application/octet-stream;charset=UTF-8");
String fileName = URLEncoder.encode(name, "UTF-8");
response.addHeader("Content-Disposition","attachment;filename=" + fileName);
out = response.getOutputStream();
in = new FileInputStream("C:/TEMP/"+id+".chiron");
byte[] b = new byte[in.available()];
in.read(b);
out.write(b);
out.flush();
} catch (Exception e)
{
System.out.println("Before e.printStackTrace");
e.printStackTrace();
}finally{
if(out!=null)
try
{
out.close();
} catch (IOException e)
{
e.printStackTrace();
}
}[/code]
这是我的js里面的代码
[code="java"]var downId = record.data.id;
var downName = record.data.realName;
confirm('确定要下载:'+downId+'?');
Ext.Ajax.request({
url : 'fileDown.action',
params : {fileId : downId,fileName : downName},
success : function(){
Ext.Msg.alert('提示','文件下载成功');
},
failure : function(){
Ext.Msg.alert('提示','文件下载失败');
},
error : function(form, action) {
Ext.Msg.alert('错误', '文件下载过程中出现了\n不可预知的错误.');
}
});[/code]
返回的时候,没有出现保存的提示框。。。。
求高手。。求真相。。。