Jump to content
Changes to the Jaspersoft community edition download ×

Webapp sample html.jsp <--> html


2005 IR Help

Recommended Posts

By: kc - kckckc

Webapp sample html.jsp <--> html

2004-12-08 08:40

I'm having a problem with the layout after executing the html output via the html.jsp. The result is a layout that is different than the output in PDF format and the images (px) are not found and instead it gives these boxes with a red triangle inside.

 

However when executing the html.servlet everything works fine, the report is the same as in PDF format.

 

Did anybody had this problem too ? Strange...

 

Kristof

 

 

 

 

By: kar_n_kar - kar_n_kar

RE: Webapp sample html.jsp <--> html

2004-12-13 03:00

If you are using JRHtmlExporter to export the report, then you have to set the IMAGES_MAP and IMAGES_URI parameters. Then it will work.

 

Your code should look like this.

 

JRHtmlExporter exporter = new JRHtmlExporter();

 

Map imagesMap = new HashMap();

session.setAttribute("IMAGES_MAP", imagesMap);

 

exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);

exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out);

exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, imagesMap);

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

 

 

Also create an images.jsp file which will get the "IMAGES_MAP" session attribute and the "image" parameter. Then pass the image data into your response object

 

---Kar

 

 

 

 

By: Alexander Wallace - aows

RE: Webapp sample html.jsp <--> html

2004-12-13 06:48

I have asked about this in another topic but had no response: Is there a way of getting the images without usin g a session? a session variable is not an option to me. Is it possible to have the the Html Exporter look for the images in the original place pointed in the XML (which in my case would be http accessible)?

 

Ty.

 

 

 

 

By: kc - kckckc

RE: Webapp sample html.jsp <--> html

2004-12-13 06:54

Thanks for your reply but I'm just deploying the webapp sample that came along Jasper and the code you mention is exactely what happens, except that the layout is one big mess... But running the servlet gives me a good output in the correct format and when looking at the code pratically the same thing happens like in the html.jsp :

JRHtmlExporter exporter = new JRHtmlExporter();

Map imagesMap = new HashMap();

request.getSession().setAttribute("IMAGES_MAP", imagesMap);

 

exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);

exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, out);

exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, imagesMap);

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

 

exporter.exportReport();

 

I also included a px file in the image directory but still with no success....

Anybody ?

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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