I have successfully created a report and successfully exported to HTML
and PDF
. However it is a static report. I have a query as:
select * from personal where id= 'val'
I want to send this parameter "val" from Java/JSP
at runtime. How to do this ?
Create a Map containing parameters and put parameters as key value pair.
When generating Jasper Report from JSP:
where the keys in the
parametersMap
shoud be excatly the same as the parameters defined in your report template.So, Declare the parameter in your report template (jrxml):
Pass parameter in query in Jasper Report
you can't select *, you have to indicate the column name that you want to get data from. use commDB.query to execute query, then pass result to commDBResult, run the loop, put each row of record into an array list, then use jasper to generate report
This will be your code for jsp.