I have a jtable which is dynamically getting data. For an example, i have a jtable which loads all the employee information by search button click. Then user can filter data from those employees. From departments, Employee numbers etc.. I want to pass those filtered data into ireports. Not by taking data from the database. Only by taking data from the jtable. i wrote following code. but it shows errors.
try {
DefaultTableModel df = ( DefaultTableModel ) jTable1.getModel();
JRTableModelDataSource dataSource = new JRTableModelDataSource(df);
String reportSource = "./Leave.jrxml";
JasperReport jr = JasperCompileManager.compileReport(reportSource);
Map<String, object> params = new HashMap<String, object>();
params.put("title1" , "title 1");
JasperPrint jp = JasperFillManager.fillReport(jr, params, dataSource);
} catch (JRException ex) {
Logger.getLogger(LeaveManagementInfosystem.class.getName()).log(Level.SEVERE, null, ex);
}
it says "title 1" is not an object. I tried it again by not adding "". but same error is occurred. how can i get rid of this error.