@Get("errinfo")
public String getErrInfo(Invocation inv, @Param("role") int role) {
HttpServletResponse response = inv.getResponse();
response.setCharacterEncoding("utf-8");
response.setContentType("application/vnd.ms-excel"); // xls格式
response.setHeader("content-disposition", "attachment;filename=errorExcel.xls");
try {
if (role == 2) {// 老师的表格式
String[] headers = { "用户名", "密码", "姓名", "性别", "学段", "学科", "提示" };
xlsDto2Excel(response, studentTiShi, headers, role);
}
else {// 学生的表格式
String[] headers = { "用户名", "密码", "姓名", "性别", "学段", "年级", "班级", "入学年份", "提示" };
xlsDto2Excel(response, studentTiShi, headers, role);
}
}
catch (Exception e) {
e.printStackTrace();
}
return null;
}
浏览器弹出下载
最新推荐文章于 2019-11-26 21:23:31 发布