Create a Map containing parameters and put parameters as key value pair.
Map parametersMap = new HashMap();
parametersMap.put("id",7);
When generating Jasper Report from JSP:
JasperPrint jasperPrint = JasperFillManager.fillReport(
jasperReport, parametersMap, jdbcConnection);
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):
<parameter name="id" class="java.lang.Integer"/>
Pass parameter in query in Jasper Report
select * from personal where id= $P{id}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…