Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

JasperReports: duplicate images on report!

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for letting us know the solution and that your cross-posted to another forum, it's good Javaranch etiquette!
 
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic