As a pure JAVA report, Runqian Setsu Report can be easily embedded into J2EE pages. Currently, Setus Report provides a variety of publishing methods for users to use when embedding reports into JSP pages. There are two types of reports in Setshu reports: parameter reports and data reports. Let’s take a look at the page embedding methods of these two types of reports.
Since most parameter reports publish query data jointly with data reports, here we only introduce the joint usage method (separate publishing is the same as data reports). The tag used when the parameter report is embedded in the page is
name="form1" paramFileName="demo_arg.rpx" params ="" /> The tag used in the data report embedded page is Different values of the srcType attribute specify different report publishing methods to meet the needs of different scenarios. Let’s take a look at them separately. When srcType="file", the report is published in file mode, and the report template name is specified through the reportFileName attribute to complete the report publishing. This method is the most commonly used report publishing method. For specific use, please refer to the following writing method: srcType="file" name="report1 " reportFileName="demo.rpx" funcBarLocation="top" needPageMark="yes" params="d_year=2014;u_id =10001" exceptionPage="/reportJsp/myError2.jsp" /> In addition to directly specifying the report file, you can also Publish the report definition (ReportDefine) read by the publishing program. To use this method, you need to specify srcType="defineBean". For specific usage, please refer to the following writing method: <% //Read the report definition String reportPath =request.getRealPath("/reportFiles/api/wangge.rpx"); ReportDefine rd =(ReportDefine)ReportUtils.read(reportPath); request.setAttribute( "reportDefine",rd); %> name ="report1" srcType="defineBean" beanName="reportDefine" exceptionPage="/reportJsp/jsp/myError.jsp" /> In addition to directly specifying the report template and receiving the report definition, sometimes it is also necessary to directly use the report (IReport) calculated by the program to publish. In this case, you need to specify srcType=" reportBean", you can refer to the following writing when using it: <% //Program calculation report String reportPath =request.getRealPath("/reportFiles/api/wangge.rpx"); ReportDefine rd =(ReportDefine)ReportUtils.read(reportPath); Context cxt = newContext(); Engine engine = newEngine(rd, cxt); IReport iReport =engine.calc(); request.setAttribute("report",iReport); %> --> srcType="reportBean" beanName="report" exceptionPage=" /reportJsp/jsp/myError.jsp" /> context method <% Context context = newContext(); // Pass parameters, data sources, etc., omitted here request.setAttribute("myContext", context ); %> contextName="myContext" /> 1. Function bar Configuring funcBarLocation="top" and needPageMark="yes" can display the function bar and page turning buttons above the report. 2.Export Print Button Configure needSaveAsWord="yes" needSaveAsExcel="yes" needSaveAsPdf="yes "needPrint="yes" can display export Word, Excel, Pdf and print buttons. 3.Fixed header Configure needScroll="yes" scrollWidth="100%"scrollHeight=" 100%" can fix the report header. Data report
file mode
defineBean method
reportBean method
In addition to the above three methods, you can also customize the context and pass it to the tag for publishing. Using context, you can pass parameters and macros, and also specify data sources, database connection factories, etc. When using it, you can refer to the following writing:
Common attribute configuration effects