EasyExcel 500 Internal Server Error

当我们遇到"500 Internal Server Error"这个的消息时,意味着服务器遇到了意外情况,无法完成请求。

在使用EasyExcel的时候出现这个问题。我们根据官网配置的HttpServletResponse中设置的header里

java 复制代码
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-disposition", "attachment;filename="+fileName);



ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), BudgetForm.class).build();

如果出现 500 Internal Server Error问题,删除fileName,不传名称过去就可以了

java 复制代码
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-disposition", "attachment;filename=");



ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), BudgetForm.class).build();

正常访问下载

相关推荐
SimonKing4 小时前
全面解决中文乱码问题:从诊断到根治
java·后端·程序员
OxYGC4 小时前
[玩转GoLang] 5分钟整合Gin / Gorm框架入门
开发语言·golang·gin
锐策4 小时前
Lua 核心知识点详解
开发语言·lua
你三大爷4 小时前
再探volatile原理
java
2301_781668614 小时前
Redis 面试
java·redis·面试
郑洁文4 小时前
基于SpringBoot的天气预报系统的设计与实现
java·spring boot·后端·毕设
kyle~4 小时前
C/C++---动态内存管理(new delete)
c语言·开发语言·c++
沃夫上校4 小时前
MySQL 中文拼音排序问题
java·mysql
Dcs4 小时前
用 Python UTCP 直调 HTTP、CLI、MCP……
java
落日沉溺于海5 小时前
React From表单使用Formik和yup进行校验
开发语言·前端·javascript