Java Reference
In-Depth Information
response.getOutputStream().print(stringWriter.toString());
}
}
}
In this servlet, we populate a key/value pair with an instance of
java.util.
HashMap
and pass that
HashMap
to the report template via the
JasperRunManager.
runReportToPdfStream()
method. As can be seen in the code, the
Map
's key must
match the parameter name in the JRXML template. After deploying the servlet and
browsing the appropriate URL, we should see a PDF report being rendered in the
browser, as demonstrated in the following screenshot: