Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jasper Report in Struts JSP

 
sandeep lokhande
Ranch Hand
Posts: 120
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bilal,
I am using Jasper report in my struts project and creating some line graph as a report,
exported as HTML file and then included in a JSP file,
For first time report is visible ,
But the next time when i create another report and goes to the same page,

The image from previous report is there instead of new image for new Report,

After refreshing the page it shows exact correct output,

i thought its problem of repeatedly same request is send,
so I have appended some random number along with the request,
but it wont work,
This is how i included the file,



what may be the reason? please help.
Thank you in advance,

And best luck for your Book, i m looking forward to learn more about jasper report.



 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try to clear the client cache.

include below line on top,in your jsp.


 
sandeep lokhande
Ranch Hand
Posts: 120
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jigar Naik wrote:try to clear the client cache.

include below line on top,in your jsp.



Yes sir,
I can see we are clearing cache but it still not working, do we have any other possibility?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to JSP; this is not related to JasperReports.

That's a static include; try a dynamic include.

http://java.sun.com/products/jsp/tags/11/syntaxref117.html
 
bilal sidiqui
Author
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sandeep,

You are including HTML representation of the jasper report directly into your jsp file. The HTML file in turn always uses images. I guess the problem is due to the cache either on the browser or on the Web server. That’s because two things (the HTML file and accompanying images) are being cached.

So try to fetch the actual HTML code from JasperReprots library and dynamically embed that code instead of including the HTML file. In addition, you may have to develop JSP logic to include some random number in the names of image files.
 
sandeep lokhande
Ranch Hand
Posts: 120
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bilal sidiqui wrote:Hi Sandeep,

You are including HTML representation of the jasper report directly into your JSP file. The HTML file in turn always uses images. I guess the problem is due to the cache either on the browser or on the Web server. That’s because two things (the HTML file and accompanying images) are being cached.

So try to fetch the actual HTML code from JasperReprots library and dynamically embed that code instead of including the HTML file. In addition, you may have to develop JSP logic to include some random number in the names of image files.

Thank you for your response sir,
but before you could answer the question,

I have made that problem solved by changing HTML page path, by adding report in some separate folder that contains timestamp,
Thus forming unique path each request and browser wont cache it,
and also try and remove caching by response.setHeader("Cache-Control","no-cache");
Its working fine,
and delivered also.
I respond to thread after problem solving, because some other person on the earth could find the solution for the same problem

Your idea of including some random number in the names of image files can also serve the purpose,

Thank you very much for your reply once again,
and i am looking forward to learn more from your new Book.
Have a Great Time here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic