Pentaho Report Designer getting started tutorial (3), pentahodesigner
Pentaho Report Designer getting started tutorial (3)
Pentaho Report Designer5.1 is the latest version.
I. Installation and introduction
This section describes how to install jdk, configure java environment variables, download pentaho report, decompress the report, and run it directly.
Ii. Example 1
3. Integration in Swing programs
4. Integration in j2ee
Create a web Project
Compile ant scripts and compile and run projects
<? Xml version = "1.0" encoding = "UTF-8" standalone = "no"?>
<Projectbasedir = "." default = "start_tomcat" name = "Ch2WebApp">
<Propertyname = "webDir" value = "war"/>
<Propertyname = "tomcat. home" value = "D:/program/tomcat6"/>
<Pathid = "classpath">
<Filesetdir = "lib">
<Export dename = "*. jar"/>
</Fileset>
<Filesetfile = "$ {tomcat. home}/lib/servlet-api.jar"/>
</Path>
<Pathid = "runtime_classpath">
<Filesetdir = "lib">
<Export dename = "*. jar"/>
</Fileset>
<Dirsetdir = "classes"/>
</Path>
<Targetname = "compile">
<Echomessage = "compile"/>
<Mkdirdir = "classes"/>
<Javacclasspathref = "classpath" destdir = "classes" srcdir = "src" includeantruntime = "on" fork = "true" encoding = "UTF-8"/>
</Target>
<Targetname = "war" depends = "compile">
<Deletefile = "chapter2.war"/>
<Warbasedir = "war" destfile = "chapter2.war" webxml = "war/WEB-INF/web. xml">
<Classesdir = "classes"/>
<Zipfilesetdir = "data" prefix = "data"/>
<Zipfilesetdir = "lib" prefix = "WEB-INF/lib"/>
</War>
<Deletedir = "$ {tomcat. home}/webapps/chapter2"/>
<Deletefile = "$ {tomcat. home}/webapps/chapter2.war"/>
<Copyfile = "chapter2.war" todir = "$ {tomcat. home}/webapps"/>
</Target>
<Targetname = "start_tomcat" depends = "war">
<Exectimeout = "1000" dir = "$ {tomcat. home}/bin" executable = "$ {tomcat. home}/bin/shutdown. bat"/>
<Sleepseconds = "2"/>
<Execdir = "$ {tomcat. home}/bin" executable = "$ {tomcat. home}/bin/startup. bat"/>
</Target>
</Project>
Ø access reports of different file formats through servlet
PublicvoidInit (ServletConfig config)ThrowsServletException {
ClassicEngineBoot.GetInstance(). Start ();
Super. Init (config );
}
ProtectedvoidDoGet (HttpServletRequest request,
HttpServletResponse response)ThrowsServletException, IOException {
Try{
ResourceManager manager =NewResourceManager ();
Manager. registerDefaults ();
String reportPath = "file :"
+This. GetServletContext (). getRealPath (
"Data/ch2_1.prpt ");
Resource res = manager. createDirectly (NewURL (reportPath ),
MasterReport.Class);
MasterReport report = (MasterReport) res. getResource ();
// Determine the output format and renderaccordingly
String outputFormat = request. getParameter ("outputFormat ");
If("Pdf". equals (outputFormat )){
// RenderPdf
Response. setContentType ("application/pdf ");
PdfReportUtil.CreatePDF(Report, response. getOutputStream ());
}Elseif("Xls". equals (outputFormat )){
// Render in excel
Response. setContentType ("application/vnd. ms-excel ");
ExcelReportUtil.CreateXLS(Report, response. getOutputStream ());
}Elseif("Rtf". equals (outputFormat )){
// Render inRtf
Response. setContentType ("application/rtf ");
RTFReportUtil.CreateRTF(Report, response. getOutputStream ());
}
}Catch(Exception e ){
E. printStackTrace ();
}
Super. DoGet (request, response );
}
Call servlet through jsp or html files
<Body>
<H1> Example Application
<P> This is an exampleapplication demonstrating how to embed
Pentaho Reporting into yourweb application. </p>
<A href = "report? OutputFormat = pdf "target =" black "> Generate PDF Report </a> <br/>
<A href = "report? OutputFormat = xls "target =" black "> Generate Excel Report </a> <br/>
<A href = "report? OutputFormat = rtf "target =" black "> Generate RTF Report </a> <br/>
</Body>
How does Pentaho Report Designer edit the name in structure?
Look for help documentation to make it faster
Who are familiar with pentaho report designer? Familiar with QQ136795830
Hello, add 315268537