@At("/exportsScheduleDetial")
@Ok("raw:stream")//"raw:stream"
public File exportsScheduleDetial(@Param("..") Map<String, String> map, HttpServletRequest request, HttpServletResponse response){
String fileId = map.get("fileId");
Manager user = SysParameter.getUser();
String orgId = user.getOrgCode();
List list = new ArrayList();
String sql = " SELECT TITLE FROM SALT_FILE WHERE FILE_ID = '" + fileId+"' ";
list = ExtManager.getExtDao().getListstrs(sql, null);
String title="";//excel名字
if(list.size()>0){
title = list.get(0);
}
String userName = user.getDepartName();
Object[][] objects = getResult(fileId, orgId, userName);
try {
File file = baseInfTemDataExport(objects);
title+="的清算进度.xls";
String filename = URLEncoder.encode(title, Encoding.UTF8);
filename = filename.replace("+", "%20");//处理文件名空格变成+号 问题
response.reset();
response.setContentType("application/octet-stream");
//response.getWriter().write("alert('成功');");
response.addHeader("Content-Disposition","attachment;filename="" + filename + """);
//request.getSession().setAttribute("mes", "下载成功");
return FileUtil.createFileIfNoExists(file);
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
这是action的代码
这下面是jsp的代码 完全不知道怎么弄啊
function exports(){
var isValid = $("#paramTables").form('validate');
if(isValid){
//$("#niu").attr('disabled',true);
$("#paramTables").submit(
);
//$("#niu").removeAttr("disabled");
}
}
本人感觉action向页面返回的是File 页面算是废了