如果动态设置分页标签

海量数据的清单式列表在读取、展现及导出过程中可能会出现速度过慢、内存溢出、系统死机等问题,分页计算extHtml标签扩展了原html标签的功能,实现了以页为单位对数据进行读取和展现及导出等操作,大大降低了内存占有量,提高了运行效率,避免内存溢出等问题。

分页标签的写法大致为:

<report:extHtml name="report1" reportFileName="api/1.6.raq" totalCountExp="query('SELECT count(*) FROM 订单明细')" params="<%=param.toString()%>" scale="1.1" pageCount="10" needPageMark="yes" funcBarFontFace="黑体" funcBarFontSize="14" funcBarFontColor="red" functionBarColor="#FFCCFF" separator="|" needSaveAsExcel="yes" needSaveAsPdf="yes" needSaveAsWord="yes" funcBarLocation="top" needPrint="yes" firstPageLabel="首页" prevPageLabel="前一页" nextPageLabel="后一页" lastPageLabel="尾页" printLabel="全打印" excelLabel="导出excel" pdfLabel="导出pdf" wordLabel="导出word" generateParamForm="yes" displayNoLinkPageMark="yes" saveAsName="测试" startRowParamName="startRow" //起始行参数名,非必填,默认值为startRow endRowParamName="endRow" //结束行参数名,非必填,默认值为endRow userFuncBarElements="<a href='http://www.runqian.com.cn'>润乾</a>" needScroll="no" scrollHeight="100" needLinkStyle="yes" exceptionPage="myErrorPage.jsp"/>
从上面我们可以看到,这里的totalCountExp属性是写死的,如果想写一个通用jsp,如何来动态设置总记录的表达式呢?
我们可以先在报表里建立一个数据集,这个数据集的sql就是查询总记录条数的,那么,这个数据集就可以在设计报表模版的时候就写好:
这样我们就可以在加载报表模版的时候,把这个sql从报表模版里面读取出来,并设置到里面分页标签里面去:
import com.runqian.report4.model.ReportDefine;