JTable contents and database table in one report
I am new to JasprReports. I learned to get JTable contents to JasperReport using,
JasperFillManager.fillReport(jasperReport, new HashMap(), new JRTableModelDataSource(table.getModel()));
and get Oracle SQL contents to the report using,
JasperFillManager.fillReport(jasperReport, new HashMap(), connection);
My question is, is it possible to get both of them in one report?
For example, I have JTable contents 开发者_StackOverflowas following:
EMP_NO, EMP_NAME, EMP_SALARY
which is the main content of the table and I want something in the header from a SQL table Department
Department_no, Department_Name
Any ideas?
Found a workaround...
I am getting the contents of the table from database to java using jdbc, and then using params hashmap to pass those contents to report.
Got this idea from here.
精彩评论