This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes JasperReports: duplicate images on report! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "JasperReports: duplicate images on report!" Watch "JasperReports: duplicate images on report!" New topic
Author

JasperReports: duplicate images on report!

Alberto Dousdebes
Greenhorn

Joined: Sep 02, 2008
Posts: 22
Hi, i have two reports embedded in a web page.



The problem is that they are two diferent reports. And Jasper put the generic name "image_0_0_0" on each image, and after it's generated by the ImageServlet. I mean:

Report 1 >>> image_0_0_0 (it's really a meter)
Report 2 >>> image_0_0_0 (it's a thermometer)

Maybe one aproach it's tell Jasper to change the name of the images on each report.

Report 1 >>> report1_0_0_0
Report 2 >>> report2_0_0_0

┬┐How can i do this?.

Thanks!!!

Alberto Dousdebes
Greenhorn

Joined: Sep 02, 2008
Posts: 22
this is the solution: i've found it on the jaspersoft forums:

If you put both print objects on the session under the same name (ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE), the second object will overwrite the first one so when the first image will be requested, the servlet will actually extract it from the second report. So you need to use distinct names for the two print objects on the session:


Thanks lucianc!
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Thanks for letting us know the solution and that your cross-posted to another forum, it's good Javaranch etiquette!


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JasperReports: duplicate images on report!
 
Similar Threads
POI and issues reading xlsx files
Image as part of HTML email
JSlider
Using JSTL Data Displayed In Browser Is Getting Fixed To 24576 Bytes(24 KB)
problem while displaying multipage tiff image in applet