Java Reference
In-Depth Information
servletOutputStream.flush();
servletOutputStream.close();
}
catch (JRException e)
{
// display stack trace in the browser
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter);
e.printStackTrace(printWriter);
response.setContentType("text/plain");
response.getOutputStream().print(stringWriter.toString());
}
}
}
After deploying this servlet and directing the browser to its URL, our browser will
display the report as a PDF, as can be seen in the following screenshot:
 
Search WWH ::




Custom Search