最近需要做一个Excel导出的功能,选择了POI插件,但是却发现JSP导出设置中文文件名会出现乱码,于是找了一些资料,希望对各位有帮助。
<%@page contentType="application/vnd.ms-excel;charset=UTF-8" language="java"%>
response.setHeader( "Content-Disposition", "inline;filename=" + new String( fileName.getBytes("gb2312"), "ISO8859-1" ) );
attachment 与 inline 解释
2.1 The Inline Disposition Type
A bodypart should be marked `inline' if it is intended to be
displayed automatically upon display of the message. Inline bodyparts
should be presented in the order in which they occur, subject to the
normal semantics of multipart messages.
2.2 The Attachment Disposition Type
Bodyparts can be designated `attachment' to indicate that they are
separate from the main body of the mail message, and that their
display should not be automatic, but contingent upon some further
action of the user. The MUA might instead present the user of a
bitmap terminal with an iconic representation of the attachments, or,
on character terminals, with a list of attachments from which the
user could select for viewing or storage.
分享到:
相关推荐
jsp导出Excel;简单实用!导出Excel;导出Word jsp导出Excel;简单实用!导出Excel;导出Word jsp导出Excel;简单实用!导出Excel;导出Word
( response.setHeader()下载中文文件名乱码问题
jsp导出excel一般性问题及解决办法
NULL 博文链接:https://lingf.iteye.com/blog/1108467
jsp页面导出excel的实现相关代码,是从整个项目中把相关的几个页面拿出来分享一下
JSP导出excel和pdf格式JSP导出excel和pdf格式
jsp实现文件下载与中文文件名乱码问题解决
jsp导入导出excel文件用的是poi和学习心得
java及jsp下导出excel表格,真心好用
jsp导出excel并支持分sheet导出的方法.docx
一种很简单的将JSP页面的table导出excel的方法
关于jsp导出excel用javascript实现
本人试过了可以用,做jsp程序导出excel功能的可以参考下,下载后按照模版进行修改
JSP导出Excel
查询数据跳转到当前的jsp,通过获取后台的接口数据导出excel文件,最后再自动跳转到上一个的页面。
JSP中导入导出Excel文件.txt
多文件上传例子,彻底解决中文乱码问题了。总结中文乱码问题如下: 1、所有页面都用UTF-8。 2、写过滤器,设置request.setCharacterEncoding("UTF-8")。 3、javascript脚本里用encodeURI(str)。 4、适当的时候,在...
不同浏览器上中文文件名的下载乱码问题 浏览器IEChromeSafariOpera 浏览器能正确识别的编码格式
如何在jsp导出到Excel文件