Jump to content
Changes to the Jaspersoft community edition download ×

BarChart doesn't work with HTML


cparis

Recommended Posts

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

How doesn't it work? Are there errors being thrown during export, or is the layout not what you expect?

 

You should always keep in mind when designing your reports is that there are certain report designs and layouts that are best suited depending on the output destination. i.e. a CSV output file has very strict rules about how you should place elements in your report in order for it to be interpreted as fields properly.

 

Anyways, please elaborate on how your report is failing in html mode and we can try to work through it.

 

Thx,

Rob

Link to comment
Share on other sites

JasperReports includes a servlet to handle images in reports exported to HTML. My guess is that you are not using this servlet.

 

Include the this servlet in your web.xml, something like this:

 

Code:

<servlet>
<servlet-name>ImageServlet</servlet-name>
<servlet-class>net.sf.jasperreports.j2ee.servlets.ImageServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ImageServlet</servlet-name>
<url-pattern>image</url-pattern>
</servlet-mapping>

 

Your Java code should look something like this:

 

Code:
[code]
JRHtmlExporter exporter = new JRHtmlExporter();
.
.
.
exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "image?image="«»);
.
.
.
exporter.exportReport();

 

For more information, check out chapter 9 of my book, [url=http://www.packtpub.com/JasperReports/book]JasperReports For Java Developers.

 

David

Link to comment
Share on other sites

Thanks for your answer, but I have the servlet in my web.xml and I have the class HtmlServlet.java, in this class I put the parameter:

setParameter(JRHtmlExporterParameter.IMAGES_URI, "image?image=");

 

My images are displayed in HTML but the BarChart is not displayed, the page is blank when I try try to export it .

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...