how create dynamic html reports?

asked 2011-12-08 12:50:46 +0800

mhj gravatar image mhj flag of Brazil
806 1 7

i did code for create dynamic pdf reports posted in this link:

what i could do for create dynamic html reports?

my code for pdf:

<?page title="new page title" contentType="text/html;charset=UTF-8"?>

<zk xmlns="http://www.zkoss.org/2005/zul">
<window title="new page title" border="normal" apply="${testeController}">
   <iframe id="PDFreport" width="100%" height="100%"/>


 * To change this template, choose Tools | Templates
 * and open the template in the editor.
package teste;

import ar.com.fdvs.dj.core.DJServletHelper;
import ar.com.fdvs.dj.domain.DynamicReport;
import ar.com.fdvs.dj.domain.builders.FastReportBuilder;
import ar.com.fdvs.dj.core.DynamicJasperHelper;
import ar.com.fdvs.dj.core.layout.ClassicLayoutManager;
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.zkoss.util.media.AMedia;
import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Iframe;

 * @author manuel
public class TesteController extends GenericForwardComposer {

    Iframe PDFreport;

    public void doAfterCompose(Component comp) throws Exception {

    public void doReport() {
        try {
            FastReportBuilder drb = new FastReportBuilder();
            DynamicReport dr;
            InputStream mediais;
            AMedia amedia;
            drb.addColumn("FirstName", "firstName", String.class.getName(), 30);
            drb.addColumn("LastName", "lastName", String.class.getName(), 30);
            drb.addColumn("MiddleName", "middleName", String.class.getName(), 30);
            drb.addColumn("SocialNumber", "socialNumber", String.class.getName(), 30);
            drb.setTitle("Test of Dynamic Columns Jasper Report");
            dr = drb.build();
            List data = new ArrayList();
            Map map1 = new HashMap();
            map1.put("firstName", "Shainaz");
            map1.put("lastName", "Tamboli");
            map1.put("middleName", "Tajudin");
            map1.put("socialNumber", "9700000000");
            System.out.println("Data:" + data);
            JRDataSource ds = new JRBeanCollectionDataSource(data);
            System.out.println("Ds:" + ds);
            JasperReport report = DynamicJasperHelper.generateJasperReport(dr, new ClassicLayoutManager(), new HashMap());
            byte[] buf = JasperRunManager.runReportToPdf(report, new HashMap(), ds);
//prepare the AMedia for iframe

            mediais = (InputStream) new ByteArrayInputStream(buf);
            amedia = new AMedia("AlarmHistoryReport.pdf", "pdf", "application/pdf", mediais);

//set iframe content
        } catch (Exception e) {

thanks in advance

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2011-12-08 15:08:08 +0800

gganassin gravatar image gganassin flag of Luxembourg
540 6

I needed to do the same in the past and i've decided to integrate a BIRT report engine in my project: it was working like a charm.

That time i've decided to separate the webapp, the web services for the CRUD and the BIRT engine in 3 different blocks for
project-related requirement but here you can keep it simple following the smalltalk here:

link publish delete flag offensive edit

answered 2011-12-08 15:36:33 +0800

mhj gravatar image mhj flag of Brazil
806 1 7

in link for app appears this
The "/Small Talks/ZkBirt.zip" file could not be found or is not available.
what a pitty!

link publish delete flag offensive edit

answered 2011-12-09 07:08:35 +0800

gganassin gravatar image gganassin flag of Luxembourg
540 6

if you want to try to play with BIRT easly... try MyEclipse IDE: it has some nice integration plugins for BIRT that easly add BIRT capabilities to your ZK project without gettin mad and offer you also an easy visual editor to paint your reports.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2011-12-08 12:50:46 +0800

Seen: 365 times

Last updated: Dec 09 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More