日期:2014-05-17  浏览次数:20765 次

struts2-jasperreports-plugin导出中文html报表出现乱码
在项目中使用统一编码 UTF-8.
报表使用ireport设计,其编码也是UTF-8.
但在导出struts2-jasperreports-plugin ,html格式的报表中文显示总有乱码.修改各种配置始终解决不了.
最后痛下杀手,修改struts2-jasperreports-plugin的代码.
修改JasperReportConstants.java中的函数 doExecute,将response.setContentType("text/html");注销.增加语句 response.setContentType("text/html;charset=UTF-8");response.setCharacterEncoding("GB2312");
,然后在看html报表的中文,显示正常.

这种修改方法对于我们的项目是够用的,但我想还应该有更好的方法.
1 楼 chenys 2007-12-17  
我的没有改,但是没有出现中文问题哦,但我也改了struts2-jasperreports-plugin的代码。
2 楼 hbczlp 2008-01-05  
我也遇到了同样的问题,struts2-jasperreports-plugin的源代码在什么地方?