I collected the data off the form and placed it in a bean class, DataBean. JRBeanCollectionDataSource constructor takes Collection as parameter, so i should convert the bean data into some kind of collection, like list, and then pass it into JRBeanCollectionDataSource and pass its instance to JasperManager.fillReport method. In iReport "$F(fieldName) notation" will be $F(bean properties name) Here is the code List<DemandSlipEntity> l = new ArrayList<DemandSlipEntity>(); l.add(dse); JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(l); InputStream in = this.getClass().getClassLoader().getResourceAsStream("reports/Demand Slip.jasper"); try { System.out.println("insidse try"); JasperPrint jpr = JasperFillManager.fillReport(in, null, ds); //JasperExportManager.exportReportToPdfFile(jpr, "C:\\demand.pdf"); JasperViewer.viewReport(jpr, false); } catch (JRException e1) { // TODO Auto-generated catch …

Member Avatar
Member Avatar
+0 forum 1

I have created an application using swing. On clicking a particular menu item, a form is loaded,and after saving it a pdf generates. For reporting, i am using iReport. Here is the code snippet MyiReportViewer.java package sms.ui.ireport; import java.awt.BorderLayout; import java.awt.Container; import java.io.InputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.HashMap; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JasperFillManager; import net.sf.jasperreports.engine.JasperPrint; import net.sf.jasperreports.swing.JRViewer; public class MyiReportViewer extends javax.swing.JInternalFrame { private MyiReportViewer() { super("Report Viewer",true,true,true,true); initComponents(); setBounds(10,10,600,500); setDefaultCloseOperation(DISPOSE_ON_CLOSE); } public MyiReportViewer(InputStream stream,HashMap parameter) { this(); try { if(stream==null){ System.out.println("Null stream"); } /* load the required JDBC driver and create the connection here JDBC Type Four …

Member Avatar
Member Avatar
+0 forum 7

create table A ( id number(6) , Amount number(10) ); create table B ( id number(6) , Amount number(10) ); insert into A values (1, 50); insert into A values (2, 500); insert into A values (1, 600); insert into A values (2, 900); insert into A values (1, 600); insert into B values (2, 30); insert into B values (1, 300); insert into B values (1, 100); insert into B values (1, 900); insert into B values (1, 770); This is what i want id = 1 sum(A.amount) = 1250 sum(B.amount) = 2070 (offcourse, a single row) This gives …

Member Avatar
Member Avatar
+0 forum 3

I have created an application with report features. report features is created via iReport My application also contains a reports folder containing all .japser files Here is the code public MyiReportViewer(InputStream stream,HashMap parameter) { this(); try { /* load the required JDBC driver and create the connection here JDBC Type Four Driver for MySQL is used*/ Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","hibernate","hibernate"); /*(Here the parameter file should be in .jasper extension i.e., the compiled report)*/ JasperPrint print = JasperFillManager.fillReport( stream, parameter, con); JRViewer viewer=new JRViewer(print); Container c=getContentPane(); c.setLayout(new BorderLayout()); c.add(viewer); } catch(ClassNotFoundException cnfe) { cnfe.printStackTrace(); } catch(SQLException sqle) { sqle.printStackTrace(); } …

Member Avatar
Member Avatar
+0 forum 18

I have a login page, which directs to Verification.jsp Login.jsp [CODE] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <body> <form action="Verification.jsp" method="POST"> <fieldset> <a rel="nofollow">FreeLancer? Sign up!</a> <br/> <input type="radio" name="r1" value="Admin" checked="checked"/>Admin<br/> <input type="radio" name="r1" value="Editors"/>Editor<br/> <input type="radio" name="r1" value="Staff"/>Journalist<br> <input type="radio" name="r1" value="Staff"/>Reporter<br/> <input type="radio" name="r1" value="Freelancers"/>Freelancer<br/> <br/> <br/> USERNAME : <input type="text" name="t1"/><br> PASSWORD : <input type="password" name="t2" /> <p/><input type="submit" value="Login"> <input type="reset"> </fieldset> </form> </body> </html> [/CODE] EveryThing in Login.jsp and verification.jsp is working fine. I am having a STAFF table, which contains data of JOURNALIST & REPORTER. So, to differentiate their ID, i …

Member Avatar
+0 forum 0

I am having a column named 'AREA' in a table named Editors. I am now making a html page for Staffs. In that page, i am having a field named 'AREA OF WORKING'. I have to retrieve values from AREA column of EDITORS table, and have to give the same areas to staffs in a list. So, that the staff can choose his area. So, i can't hardcode the values in HTML page. So, how to proceed with the above mentioned problem?

Member Avatar
Member Avatar
+0 forum 1

The End.