自定义导出文件名
按照网上的办法修改 showReport.jsp 页面,重新启动 tomcat, 程序报错如下:
Exception report
messageUnable to compile class for JSP:
descriptionThe server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 37 in the jsp file: /reportJsp/showReport.jsp
ReportDefine cannot be resolved to a type
34: StringBuffer param=new StringBuffer();
35: //瀵煎嚭淇濆瓨excel鏂囦欢鍚�
36: String reportPath = request.getRealPath("/WEB-INF/reportFiles/"+report);
37: ReportDefine rd = (ReportDefine)ReportUtils.read(reportPath);
38: Context cxt = new Context();
39: Engine engine = new Engine(rd, cxt); // 鏋勯�犳姤琛ㄥ紩鎿�
40: IReport iReport = engine.calc(); // 杩愮畻鎶ヨ〃
An error occurred at line: 37 in the jsp file: /reportJsp/showReport.jsp
ReportDefine cannot be resolved to a type
34: StringBuffer param=new StringBuffer();
35: //瀵煎嚭淇濆瓨excel鏂囦欢鍚�
36: String reportPath = request.getRealPath("/WEB-INF/reportFiles/"+report);
37: ReportDefine rd = (ReportDefine)ReportUtils.read(reportPath);
38: Context cxt = new Context();
39: Engine engine = new Engine(rd, cxt); // 鏋勯�犳姤琛ㄥ紩鎿�
40: IReport iReport = engine.calc(); // 杩愮畻鎶ヨ〃
An error occurred at line: 39 in the jsp file: /reportJsp/showReport.jsp
Engine cannot be resolved to a type
36: String reportPath = request.getRealPath("/WEB-INF/reportFiles/"+report);
37: ReportDefine rd = (ReportDefine)ReportUtils.read(reportPath);
38: Context cxt = new Context();
39: Engine engine = new Engine(rd, cxt); // 鏋勯�犳姤琛ㄥ紩鎿�
40: IReport iReport = engine.calc(); // 杩愮畻鎶ヨ〃
41: String saveName=iReport.getCell(1,1).getValue().toString();
42: //淇濊瘉鎶ヨ〃鍚嶇О鐨勫畬鏁存��
少 import 类了,jsp 里加上对应的类引入。
<%@ page import=“com.raqsoft.report.model.*”%>
<%@ page import=“com.raqsoft.report.usermodel.*”%>
<%@ page import=“com.raqsoft.report.view.*”%>
<%@ page import=“com.raqsoft.report.util.*”%>
<%@ page import="com.raqsoft.report.view.pdf.
前四个 import 就行
改了之后就好使了,但是如果那个单元格是表达式,是不不好使啊???文本属性值是可以的
如果是通过 iReport 对象获取的话,获取的是报表计算之后的对象,那么获取到的应该是表达式计算后的结果。
你可以输出下,看下获取到的是什么