aspose file tools*
The moose likes Other Open Source Projects and the fly likes how to create two simple jasper subreport and integrated to master report Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "how to create two simple jasper subreport and integrated to master report " Watch "how to create two simple jasper subreport and integrated to master report " New topic
Author

how to create two simple jasper subreport and integrated to master report

singh Mari
Greenhorn

Joined: Mar 25, 2009
Posts: 6
sir,
Thank you for your reply.now i correct null connection error. The following code used"

master.jrxml
<connectionExpression><![CDATA[java.sql.DriverManager.getConnection("jdbc:mysql://localhost:3306/sims1", "root", "pwd")]]></connectionExpression>

But i run the program only master report can occur not subreport.
The exact code i used:

Print.java
//Map parameters = new HashMap();
//parameters.put("SUBREPORT_DIR",subreport);
HashMap<String, String> parameters = new HashMap<String, String>();
Class.forName("com.mysql.jdbc.Driver");
Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/sims1", "root", "pwd");
//Statement stmt = (Statement) con.createStatement();
//ResultSet rs = stmt.executeQuery("SELECT * FROM consolidateprint");
//JRResultSetDataSource dataSource = new JRResultSetDataSource(rs);
JasperReport jasperReport = JasperCompileManager.compileReport("C://SIMS/web/error1.jrxml");
// JasperReport jasperReport1 = JasperCompileManager.compileReport("C://SIMS/web/suberror1.jrxml");
JasperPrint jprint = JasperFillManager.fillReport(jasperReport, parameters,con);
JasperViewer jasViewer = new JasperViewer(jprint, false);
jasViewer.setVisible(true);
jasViewer.toFront();

so i want how to pass the parameter, connection to jasper subreport

Please sir help me for this problem.


Thanks
 
 
subject: how to create two simple jasper subreport and integrated to master report