Jump to content
We've recently updated our Privacy Statement, available here ×

How does one access Jasper Report's resources in JavaEE enviroment


Recommended Posts

Recently i have been working on an online reporting tool that integrates php and Jasper Reports. I designed the reports using IReport designer then compiled them ran and all was well not untill i decided to test them in the JavaEE web application. This report has a reference to an image that seem to bring alot of problems when requesting for the report. Her is the source code below:

response.setContentType("application/pdf");//set the content type to application/pdf

ServletOutputStream out = response.getOutputStream();

InputStream resourceAsStream = getServletContext().getResourceAsStream("/reports/CaltexSales.jasper");

JasperRunManager.runReportToPdfStream(resourceAsStream, out, new HashMap(), connection);

out.flush();

  ***This works well with reports that do not have image references in them.

Can anyone please show me how to reference the images, they are in the same directory /reports

Link to comment
Share on other sites

  • 1 month later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

<parameter name="LOGO" class="java.io.InputStream" isForPrompting="false">  <defaultValueExpression><![CDATA[]]></defaultValueExpression> </parameter>..[/code]

 I think i am going to answer myself, I just had to have a java.io.InputStream as one of my parameters here is the code snippet of the jrmx file.        

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...